[commit: ghc] master: Fix 'SPECIALISE instance' (1a4c04b)

git at git.haskell.org git at git.haskell.org
Wed Dec 21 14:06:39 UTC 2016


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

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

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

commit 1a4c04b13a695a530ee24835a7550a8c9ed2d37a
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Dec 21 12:24:41 2016 +0000

    Fix 'SPECIALISE instance'
    
    Trac #12944 showed that the DsBinds code that implemented a
    SPECIALISE pragma was inadequate if the constraints solving
    added let-bindings for dictionaries.  The result was that
    we ended up with an unbound dictionary in a DFunUnfolding -- and
    Lint didn't even check for that!
    
    Fixing this was not entirely straightforward
    
    * In DsBinds.dsSpec we use a new function
         TcEvidence.collectHsWrapBinders
      to pick off the lambda binders from the HsWapper
    
    * dsWrapper now returns a (CoreExpr -> CoreExpr) function
    
    * CoreUnfold.specUnfolding now takes a (CoreExpr -> CoreExpr)
      function it can use to specialise the unfolding.
    
    On the whole the code is simpler than before.


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

1a4c04b13a695a530ee24835a7550a8c9ed2d37a
 compiler/coreSyn/CoreUnfold.hs                     | 63 +++++++-------
 compiler/deSugar/DsArrows.hs                       |  4 +-
 compiler/deSugar/DsBinds.hs                        | 98 ++++++++++++----------
 compiler/deSugar/DsExpr.hs                         | 11 ++-
 compiler/deSugar/Match.hs                          |  5 +-
 compiler/specialise/Specialise.hs                  | 29 +++----
 compiler/typecheck/TcEvidence.hs                   | 19 ++++-
 compiler/typecheck/TcInstDcls.hs                   |  2 +-
 testsuite/tests/deSugar/should_compile/T12944.hs   | 36 ++++++++
 testsuite/tests/deSugar/should_compile/all.T       |  1 +
 .../tests/indexed-types/should_compile/T12444a.hs  | 12 +++
 11 files changed, 182 insertions(+), 98 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 1a4c04b13a695a530ee24835a7550a8c9ed2d37a


More information about the ghc-commits mailing list