Added error handling for using auto in a generic constraint

This commit is contained in:
Mattia Giambirtone 2022-12-05 12:13:21 +01:00
parent 572443a988
commit 6caaf7e707
1 changed files with 2 additions and 0 deletions

View File

@ -1431,6 +1431,8 @@ proc unpackGenerics(self: Compiler, condition: Expression, list: var seq[tuple[m
case condition.kind:
of identExpr:
list.add((accept, self.inferOrError(condition)))
if list[^1].kind.kind == Auto:
self.error("automatic types cannot be used within generics", condition)
of binaryExpr:
let condition = BinaryExpr(condition)
case condition.operator.lexeme: