haxe icon indicating copy to clipboard operation
haxe copied to clipboard

[tests] Add more Null op tests

Open yuxiaomao opened this issue 1 year ago • 1 comments

When I made the HL implementation for null ops, I found that we can have some more spec tests

  • when doing </>/<=/>= between null values: it does not really make sens but I think it's good to ensure the same behavior
  • between null : Null<Int> and 0 : Null<Int>: it's different than Null<Int> with Int, at least the code generated by HL is different

It seems work as expected on HL, let's see if tests pass for other target.

yuxiaomao avatar Apr 22 '24 12:04 yuxiaomao

In summary:

Cpp fail because when comparing null <= null, it convert the value to 0 first (I don't think it's really a problem by itself).

Php fail because I added analyzer(ignore) on testOps. Probably the assign does not worked:

var k = false;
f((k = true) ? false : true);
t(k);

Lua: I can't understand the error 😢

yuxiaomao avatar Apr 22 '24 13:04 yuxiaomao

Could you update this branch? I'd like to see the exact cpp error.

Simn avatar Jul 25 '24 12:07 Simn

After talking with @yuxiaomao we agreed that C++ is actually correct here because we basically test null >= null and that should be true, not false. That means that both the HL and JVM implementations need a fix.

Simn avatar Jul 25 '24 13:07 Simn