Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Jan 15, 2025
1 parent 5f42184 commit 7324bfe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion compiler/constants.jou
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class Constant:
case ConstantKind.String:
printf("string ")
print_string(self->str, strlen(self->str))
printf("\n")

def free(self) -> None:
if self->kind == ConstantKind.String:
Expand Down
2 changes: 1 addition & 1 deletion compiler/typecheck/step3_function_and_method_bodies.jou
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def check_binop(
got_bools = lhs->types.type == boolType and rhs->types.type == boolType
got_integers = lhs->types.type->is_integer_type() and rhs->types.type->is_integer_type()
got_numbers = lhs->types.type->is_number_type() and rhs->types.type->is_number_type()
got_enums = lhs->types.type->kind == TypeKind.Enum and rhs->types.type->kind == TypeKind.Enum
got_enums = lhs->types.type->kind == TypeKind.Enum and lhs->types.type == rhs->types.type
got_pointers = (
lhs->types.type->is_pointer_type()
and rhs->types.type->is_pointer_type()
Expand Down
13 changes: 13 additions & 0 deletions tests/wrong_type/enums_mix_eq.jou
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
enum Foo:
Bar
Baz

enum Color:
Red
Green
Bool

def main() -> int:
if Foo.Baz == Color.Green: # Error: wrong types: cannot compare Foo and Color
pass
return 0

0 comments on commit 7324bfe

Please sign in to comment.