fix(checker): change back warning to errors
This commit is contained in:
@@ -135,8 +135,7 @@ 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):
|
||||||
# TODO: change back to error when operations are type checked
|
self.reporter.error(expr.location, f"Must be a boolean but is {type}")
|
||||||
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
|
||||||
@@ -183,8 +182,7 @@ 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):
|
||||||
# TODO: change back to error when operations are type checked
|
self.reporter.error(
|
||||||
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}",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user