[commit: ghc] master: Fix decompsePiCos and visible type application (aedbf7f)

git at git.haskell.org git at git.haskell.org
Tue Jul 10 11:45:26 UTC 2018


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

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

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

commit aedbf7f1c402ecbcb5ff192d5fb4dd6dd4771bf8
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.


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

aedbf7f1c402ecbcb5ff192d5fb4dd6dd4771bf8
 compiler/typecheck/TcFlatten.hs                    |  12 ++-
 compiler/typecheck/TcHsType.hs                     |   5 +-
 compiler/types/Coercion.hs                         | 110 +++++++++++++--------
 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, 107 insertions(+), 49 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 aedbf7f1c402ecbcb5ff192d5fb4dd6dd4771bf8


More information about the ghc-commits mailing list