[commit: ghc] master: Ensure nested binders have Internal Names (baf9ebe)

git at git.haskell.org git at git.haskell.org
Thu Jan 5 08:52:37 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/baf9ebe55a51827c0511b3a670e60b9bb3617ab5/ghc

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

commit baf9ebe55a51827c0511b3a670e60b9bb3617ab5
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Jan 4 17:47:13 2017 +0000

    Ensure nested binders have Internal Names
    
    This is a long-standing bug.  A nested (non-top-level) binder
    in Core should not have an External Name, like M.x. But
    
    - Lint was not checking this invariant
    
    - The desugarer could generate programs that failed the
      invariant.  An example is in
      tests/deSugar/should_compile/T13043, which had
         let !_ = M.scState in ...
      This desugared to
         let ds = case M.scSate of M.scState { DEFAULT -> () }
         in case ds of () -> ...
    
      We were wrongly re-using that scrutinee as a case binder.
      And Trac #13043 showed that could ultimately lead to two
      top-level bindings with the same closure name.  Alas!
    
    - The desugarer had one other place (in DsUtils.mkCoreAppDs)
      that could generate bogus code
    
    This patch fixes all three bugs, and adds a regression test.


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

baf9ebe55a51827c0511b3a670e60b9bb3617ab5
 compiler/coreSyn/CoreLint.hs                     | 61 ++++++++++++------------
 compiler/deSugar/DsUtils.hs                      | 11 +++--
 compiler/deSugar/Match.hs                        | 44 +++++++++++------
 testsuite/tests/deSugar/should_compile/T13043.hs | 28 +++++++++++
 testsuite/tests/deSugar/should_compile/all.T     |  1 +
 5 files changed, 94 insertions(+), 51 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 baf9ebe55a51827c0511b3a670e60b9bb3617ab5


More information about the ghc-commits mailing list