Open pjonsson opened 10 years ago
I have now investigated this bug, and the problem is simply that the code motion sees the two parts of the pair as identical expressions, despite them having different types.
I don't know exactly how to solve this best. Currently, I'm just using alphaEq
to compare expressions. Should I do something else to take the types into account?
That sounds like a problem elsewhere.
@emilaxelsson: is the AlphaEq
instance for Conversion wrong in Feldspar? It uses alphaEqSymDefault
which sounds perfectly sane.
I tried comparing the types of the expressions (like typeRep e1 == typeRep e2
) as well as using alphaEq
, and that seems to fix the problem. I don't know if that's the right way of doing it, but it seems to work.
The real problem is the equality test since two expressions of different types are considered equivalent despite the fact that we can observe they are different.
Your explicit testing for type equality sounds like a good workaround at the moment though since Emil seems to be preoccupied with other things. Can you submit a pull request with that change?
For the books: workaround merged as #15. Remember to remove that code when this bug is fixed.
Changing title of the ticket to reflect the underlying issue.
cc @jankner (did that work?)
Example from the calling convention test suite:
Gives an exception somewhere in the rebuilding of expressions: