[commit: ghc] ghc-8.6: Fix decompsePiCos and visible type application (5b10d53)

git at git.haskell.org git at git.haskell.org
Sat Jul 14 18:58:00 UTC 2018


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

On branch  : ghc-8.6
Link       : http://ghc.haskell.org/trac/ghc/changeset/5b10d537bde8e1c1cf5e0359d38dac7351ae8b2a/ghc

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

commit 5b10d537bde8e1c1cf5e0359d38dac7351ae8b2a
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Jul 9 17:20:06 2018 +0100

    Fix decompsePiCos and visible type application
    
    Trac #15343 was caused by two things
    
    First, in TcHsType.tcHsTypeApp, which deals with the type argment
    in visible type application, we were failing to call
    solveLocalEqualities. But the type argument is like a user type
    signature so it's at least inconsitent not to do so.
    
    I thought that would nail it.  But it didn't. It turned out that we
    were ended up calling decomposePiCos on a type looking like this
        (f |> co) Int
    
    where co :: (forall a. ty) ~ (t1 -> t2)
    
    Now, 'co' is insoluble, and we'll report that later.  But meanwhile
    we don't want to crash in decomposePiCos.
    
    My fix involves keeping track of the type on both sides of the
    coercion, and ensuring that the outer shape matches before
    decomposing.  I wish there was a simpler way to do this. But
    I think this one is at least robust.
    
    I suppose it is possible that the decomposePiCos fix would
    have cured the original report, but I'm leaving the one-line
    tcHsTypeApp fix in too because it just seems more consistent.
    
    (cherry picked from commit aedbf7f1c402ecbcb5ff192d5fb4dd6dd4771bf8)


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

5b10d537bde8e1c1cf5e0359d38dac7351ae8b2a
 compiler/typecheck/TcFlatten.hs                    | 12 ++-
 compiler/typecheck/TcHsType.hs                     |  5 +-
 compiler/types/Coercion.hs                         | 99 ++++++++++++++--------
 compiler/types/Coercion.hs-boot                    |  2 +-
 compiler/types/Type.hs                             |  4 +-
 testsuite/tests/dependent/should_fail/T15343.hs    | 14 +++
 .../tests/dependent/should_fail/T15343.stderr      |  7 ++
 testsuite/tests/dependent/should_fail/all.T        |  2 +
 8 files changed, 102 insertions(+), 43 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 5b10d537bde8e1c1cf5e0359d38dac7351ae8b2a


More information about the ghc-commits mailing list