Skip to content

Commit f675c39

Browse files
kaizhangNVcsyonghe
andauthored
Fix the parser issue for not recognize Generic<T>[N] (#5912)
Close #5911. In this issue, if we define the generic in source file 1, and import it into source file 2, then when parsing the reference of that generic in source file 2, we will not parse the generic directly, instead we have a logic to speculate it as generics first with a fake diagnostic sink, and if there is no error report, we will consider it as a actual generic and will parse it again. In this logic, we will also disambiguate the expression based on the following token, but we didn't consider the token '[', so we will finally not treat the expression as generic. The fix is just simply add '[' here. Co-authored-by: Yong He <yonghe@outlook.com>
1 parent a805756 commit f675c39

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

source/slang/slang-parser.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,7 @@ static Expr* tryParseGenericApp(Parser* parser, Expr* base)
23352335
case TokenType::Dot:
23362336
case TokenType::LParent:
23372337
case TokenType::RParent:
2338+
case TokenType::LBracket:
23382339
case TokenType::RBracket:
23392340
case TokenType::Colon:
23402341
case TokenType::Comma:

0 commit comments

Comments
 (0)