diff --git a/toy-impl/parse_stmt.py b/toy-impl/parse_stmt.py index b987a73..864b21a 100644 --- a/toy-impl/parse_stmt.py +++ b/toy-impl/parse_stmt.py @@ -128,12 +128,12 @@ def parse_if_stmt(ctx: Context, t = parse_expr(ctx, sym_table, node.test.left.args[0]) if not isinstance(t, TypeVariable) or len(t.constraints) < 2: raise CustomError( - 'type guard only support basic type variables with constraints', + 'type guard only support basic bounded type variables', node.test) t1, _ = parse_type(ctx, node.test.comparators[0]) if t1 not in t.constraints: raise CustomError( - f'{t1} is not in constraints of {t}', + f'{t1} is not a possible instance of {t}', node.test) t2 = [v for v in t.constraints if v != t1] try: