Disallow old style generic constraint parsing

This commit is contained in:
2026-03-23 20:01:50 +01:00
parent 8c173431c0
commit 3045223eb3

View File

@@ -1054,7 +1054,7 @@ proc funDecl(self: Parser, isOperator: bool = false): FunDecl =
if self.match("*"):
function.isPrivate = false
self.checkDecl(function.isPrivate)
if self.check(["<", "["]):
if self.check("["):
self.parseGenerics(function)
if self.match(LeftParen):
var parameter: tuple[name: IdentExpr, valueType: Expression]
@@ -1215,7 +1215,7 @@ proc typeDecl(self: Parser): TypeDecl =
result = newTypeDecl(name, newOrderedTable[string, TypeField](), true, token, @[], false, false)
result.file = self.file
result.isPrivate = not self.match("*")
if self.check(["<", "["]):
if self.check("["):
self.parseGenerics(result)
self.checkDecl(result.isPrivate)
self.expect("=", "expecting '=' after type name")