fix(checker): change some diagnostics to warnings

temporarily change type errors in predicates to warnings until operations are fully type checked
This commit is contained in:
2026-06-19 14:41:43 +02:00
parent 0eca23b894
commit d0f1178c17

View File

@@ -101,7 +101,8 @@ class MidasTyper(m.Stmt.Visitor[None], m.Expr.Visitor[Type], m.Type.Visitor[Type
def assert_bool(self, expr: m.Expr): def assert_bool(self, expr: m.Expr):
type: Type = self.type_of(expr) type: Type = self.type_of(expr)
if not self.types.is_subtype(type, self._bool): if not self.types.is_subtype(type, self._bool):
self.reporter.error(expr.location, f"Must be a boolean but is {type}") # TODO: change back to error when operations are type checked
self.reporter.warning(expr.location, f"Must be a boolean but is {type}")
def visit_type_stmt(self, stmt: m.TypeStmt) -> None: def visit_type_stmt(self, stmt: m.TypeStmt) -> None:
name: str = stmt.name.lexeme name: str = stmt.name.lexeme
@@ -148,7 +149,8 @@ class MidasTyper(m.Stmt.Visitor[None], m.Expr.Visitor[Type], m.Type.Visitor[Type
] ]
if not self._is_valid_predicate(type): if not self._is_valid_predicate(type):
self.reporter.error( # TODO: change back to error when operations are type checked
self.reporter.warning(
stmt.body.location, stmt.body.location,
f"Predicate function body must evaluate to a boolean, got {type}", f"Predicate function body must evaluate to a boolean, got {type}",
) )