[commit: ghc] wip/spj-temp: Fix desugaring of pattern bindings (again) (07bdbea)

git at git.haskell.org git at git.haskell.org
Thu Sep 29 08:37:15 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/spj-temp
Link       : http://ghc.haskell.org/trac/ghc/changeset/07bdbeabb04662a80dea289d0aeb898ff75f23f9/ghc

>---------------------------------------------------------------

commit 07bdbeabb04662a80dea289d0aeb898ff75f23f9
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Sep 16 22:33:20 2016 +0100

    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.


>---------------------------------------------------------------

07bdbeabb04662a80dea289d0aeb898ff75f23f9
 compiler/deSugar/DsBinds.hs                        |   3 +-
 compiler/deSugar/DsUtils.hs                        | 136 ++++++++++++---------
 compiler/deSugar/Match.hs                          |  21 +++-
 testsuite/tests/deSugar/should_run/T12595.hs       |  10 ++
 .../tests/deSugar/should_run/T12595.stdout         |   0
 testsuite/tests/deSugar/should_run/all.T           |   1 +
 6 files changed, 109 insertions(+), 62 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 07bdbeabb04662a80dea289d0aeb898ff75f23f9


More information about the ghc-commits mailing list