Closed ggreif closed 1 year ago
My hunch is that rename wasn't updated to accommodate or patterns with bindings...
ir_def/rename.ml
| AltP (p1, p2) -> assert(Freevars.(M.is_empty (pat p1)));
assert(Freevars.(M.is_empty (pat p2)));
let (p1', _) = pat rho p1 in
let (p2' ,_) = pat rho p2 in
(AltP (p1', p2'), rho)
unfortunately, not entirely trivial to fix because the recursive calls will need to agree on the renaming - this is the only construct that introduces two binding occurrences for the same identifier. Annoying.
UPDATE: the solution may be to rename in p1, but just substitute in p2 (without extending rho1 or returning rho2). Except that this won't work if its a tree, not a list, of patterns. Hmmm.
I'll try to fix it.
Confirmed. Using moc
from dfx
0.15.2(-beta.2) and it works just fine.
This snippet crashes the compiler:
Of course the workaround is to write
instead. Here is the backtrace: