Fix desugaring of pattern bindings (again)
This patch fixes Trac #12595. The problem was with a pattern binding like !x = e For a start it's silly to match that pattern and build a unit tuple (the General Case of mkSelectorBinds); but that's what was happening because the bang fell through to the general case. But for a variable pattern building any auxiliary bindings is stupid. So the patch introduces a new case in mkSelectorBinds for variable patterns. Then it turned out that if 'e' was a plain variable, and moreover was imported GlobalId, then matchSinglePat made it a /bound/ variable, which should never happen. That ultimately caused a linker error, but the original bug was much earlier.
Showing
- compiler/deSugar/DsBinds.hs 1 addition, 2 deletionscompiler/deSugar/DsBinds.hs
- compiler/deSugar/DsUtils.hs 81 additions, 55 deletionscompiler/deSugar/DsUtils.hs
- compiler/deSugar/Match.hs 16 additions, 5 deletionscompiler/deSugar/Match.hs
- testsuite/tests/deSugar/should_run/T12595.hs 10 additions, 0 deletionstestsuite/tests/deSugar/should_run/T12595.hs
- testsuite/tests/deSugar/should_run/T12595.stdout 1 addition, 0 deletionstestsuite/tests/deSugar/should_run/T12595.stdout
- testsuite/tests/deSugar/should_run/all.T 1 addition, 0 deletionstestsuite/tests/deSugar/should_run/all.T
testsuite/tests/deSugar/should_run/T12595.hs
0 → 100644
Please register or sign in to comment