fix(checker): adjust error message location

when constraint doesn't evaluate to a boolean, report error on the constraint expression instead of the whole type
This commit is contained in:
2026-07-09 17:38:53 +02:00
parent 44984af8a3
commit a7b62e752b

View File

@@ -408,7 +408,7 @@ class MidasTyper(m.Stmt.Visitor[None], m.Expr.Visitor[Type], m.Type.Visitor[Type
self._predicate_params = {}
if not self.types.is_subtype(constraint_type, self._bool):
self.reporter.error(
type.location,
type.constraint.location,
f"Constraint must evaluate to a boolean, got {constraint_type}",
)