haxe
haxe copied to clipboard
Prefer casting rhs to lhs when unifying equality operators
It was found that when doing lhs == rhs, the compiler first tries to assign lhs to rhs and thus also prefers implicit casts in that direction, which seems unintuitive. This change flips the order and so the algorithm is this:
- try casting rhs to lhs
- if that fails, try casting lhs to rhs
- if that fails too, report the error from the first attempt
I think that's more natural. This is a pretty central change though because it has probably been like that since the original introduction of abstracts. Our unit tests seem fine but there's a failure in the tink tests:
Refs: [./tests/Refs.hx:6]
testImplicit: [./tests/Refs.hx:7]
- [FAIL] [./tests/Refs.hx:9] r == 5 (@[5] == @[5])
cc @back2dos