summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2024-12-19 00:27:30 -0600
committerGitHub <noreply@github.com>2024-12-18 22:27:30 -0800
commitf675c39340ac751fcabc1f30604c8ea737fbe57f (patch)
treee745cdd3b6682b610098a9722cc562f4fe484506
parenta80575608e0296e1779c2085b893145893e4cc20 (diff)
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>
-rw-r--r--source/slang/slang-parser.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index 10dbe3140..8a4ba55eb 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -2335,6 +2335,7 @@ static Expr* tryParseGenericApp(Parser* parser, Expr* base)
case TokenType::Dot:
case TokenType::LParent:
case TokenType::RParent:
+ case TokenType::LBracket:
case TokenType::RBracket:
case TokenType::Colon:
case TokenType::Comma: