-
-
Notifications
You must be signed in to change notification settings - Fork 672
Closed
Description
Copying a note here from the compiler sources for discussion:
TODO: Currently, the common type of any binary expression is the first operand's type. This
differs from C and other languages where comparing an int to a long, in this order, upcasts
left to a long before comparison, instead of failing when trying to downcast right to an int.
NOTE that if we change the current behaviour, some examples, tests and wiki pages will have
to be updated, while compound binary operations must retain the previous behavior.
While I like the current behavior because it rather emits an error instead of doing possibly unwanted implicit type-conversions plus how easy it is to annotate the operation's type on the left operand (<i32>left < right
guaranteeing i32.lt_s
), it certainly is non-standard and there might be valid reasons to do it like C instead. Feel free to discuss.
Metadata
Metadata
Assignees
Labels
No labels