[commit: ghc] ghc-8.0: Fix desugaring of pattern bindings (again) (d2695b8)

git at git.haskell.org git at git.haskell.org
Sun Oct 2 01:04:38 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/d2695b842dc8ba94fbfb8527f13c7fd14611facb/ghc

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

commit d2695b842dc8ba94fbfb8527f13c7fd14611facb
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.
    
    (cherry picked from commit 2fbfbca2d12a8e9a09627529cf4f8284b19023ff)


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

d2695b842dc8ba94fbfb8527f13c7fd14611facb
 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 d2695b842dc8ba94fbfb8527f13c7fd14611facb


More information about the ghc-commits mailing list