Skip to content

Commit

Permalink
float/double related implicit conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Dec 14, 2023
1 parent 64d8995 commit fbc186e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion self_hosted/runs_wrong.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ tests/other_errors/missing_value_in_return.jou
tests/other_errors/noreturn_but_return_with_value.jou
tests/other_errors/noreturn_but_return_without_value.jou
tests/should_succeed/compiler_cli.jou
tests/should_succeed/implicit_conversions.jou
tests/should_succeed/linked_list.jou
tests/should_succeed/pointer.jou
tests/should_succeed/printf.jou
Expand Down
2 changes: 2 additions & 0 deletions self_hosted/typecheck.jou
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def can_cast_implicitly(from: Type*, to: Type*) -> bool:
and from->size_in_bits < to->size_in_bits
and not (from->kind == TypeKind::SignedInteger and to->kind == TypeKind::UnsignedInteger)
)
or (from == &float_type and to == &double_type)
or (from->is_integer_type() and to->kind == TypeKind::FloatingPoint)
or (from->is_pointer_type() and to->is_pointer_type() and (from == &void_ptr_type or to == &void_ptr_type))
)

Expand Down
2 changes: 1 addition & 1 deletion self_hosted/types.jou
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Type:

# Pointers and arrays of a given type live as long as the type itself.
# To make it possible, we just store them within the type.
# These are initially NULL and created in dynamically as needed.
# These are initially NULL and created dynamically as needed.
#
# Do not access these outside this file.
cached_pointer_type: Type*
Expand Down

0 comments on commit fbc186e

Please sign in to comment.