fix: make free error message more clear
This commit is contained in:
parent
e87e61b152
commit
b5e72660b7
@ -125,7 +125,7 @@ object typeChecker {
|
||||
Constraint.IsEither(
|
||||
KnownType.Array(?),
|
||||
KnownType.Pair(?, ?),
|
||||
"free must be an array or pair"
|
||||
"free must be applied to an array or pair"
|
||||
)
|
||||
)
|
||||
case Return(expr) =>
|
||||
@ -163,6 +163,7 @@ object typeChecker {
|
||||
checkValue(elem, Constraint.Is(KnownType.Int, "array index must be an int"))
|
||||
acc match {
|
||||
case KnownType.Array(innerTy) => Some(innerTy)
|
||||
case ? => Some(?)
|
||||
case nonArrayTy =>
|
||||
ctx.error(
|
||||
Error.TypeMismatch(elem.pos, KnownType.Array(?), acc, "cannot index into a non-array")
|
||||
|
Loading…
x
Reference in New Issue
Block a user