Closed sjorn3 closed 6 years ago
Turning it into a test case might be a challenge if we don't want to depend on Charlotte, perhaps compile something without optimisation and then once the parser is working we can create a test that optimises that.
Anyway, the process to test it with Charlotte that I've been using is:
this(x) = x == 0 || x == 1 ? 1 : 0
wasm_module([this => Tuple{Int}])
Call in interpretwasm / some other interpreter. Make sure this(0)
and this(1)
both give 1.
On tests, I'm good with tests of WebAssembly going into Charlotte.
Anyway, looks good to me.
The tests don't have to be end-to-end – if there's a minimal WASM block that reveals this error, we can just test that running the pass on it gives expected output.
In the end the problem was that the branches weren't being updated properly after creating an if. Should be correct now. There was another slightly subtler issue on the julia-0.7 branch for Charlotte that didn't help finding this, but both things should be good now.