[Git][ghc/ghc][master] Simplify treatment of heterogeneous equality

Marge Bot gitlab at gitlab.haskell.org
Sat Mar 21 00:43:03 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
73a7383e by Richard Eisenberg at 2020-03-21T00:42:56Z
Simplify treatment of heterogeneous equality

Previously, if we had a [W] (a :: k1) ~ (rhs :: k2), we would
spit out a [D] k1 ~ k2 and part the W as irreducible, hoping for
a unification. But we needn't do this. Instead, we now spit out
a [W] co :: k2 ~ k1 and then use co to cast the rhs of the original
Wanted. This means that we retain the connection between the
spat-out constraint and the original.

The problem with this new approach is that we cannot use the
casted equality for substitution; it's too like wanteds-rewriting-
wanteds. So, we forbid CTyEqCans that mention coercion holes.

All the details are in Note [Equalities with incompatible kinds]
in TcCanonical.

There are a few knock-on effects, documented where they occur.

While debugging an error in this patch, Simon and I ran into
infelicities in how patterns and matches are printed; we made
small improvements.

This patch includes mitigations for #17828, which causes spurious
pattern-match warnings. When #17828 is fixed, these lines should
be removed.

- - - - -


30 changed files:

- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/HsToCore/PmCheck.hs
- compiler/typecheck/Constraint.hs
- compiler/typecheck/TcCanonical.hs
- compiler/typecheck/TcErrors.hs
- compiler/typecheck/TcFlatten.hs
- compiler/typecheck/TcHsType.hs
- compiler/typecheck/TcInteract.hs
- compiler/typecheck/TcMType.hs
- compiler/typecheck/TcOrigin.hs
- compiler/typecheck/TcPluginM.hs
- compiler/typecheck/TcSMonad.hs
- compiler/typecheck/TcSimplify.hs
- compiler/typecheck/TcUnify.hs
- testsuite/tests/dependent/should_fail/BadTelescope5.stderr
- testsuite/tests/dependent/should_fail/T14066.stderr
- testsuite/tests/dependent/should_fail/T14066e.stderr
- testsuite/tests/ghci.debugger/scripts/break012.stdout
- testsuite/tests/indexed-types/should_fail/T14887.stderr
- testsuite/tests/indexed-types/should_fail/T3330c.stderr
- testsuite/tests/partial-sigs/should_fail/T14584.stderr
- testsuite/tests/patsyn/should_fail/T15685.stderr
- testsuite/tests/polykinds/T11399.stderr
- testsuite/tests/polykinds/T14846.stderr
- testsuite/tests/polykinds/T17841.stderr
- testsuite/tests/polykinds/T7278.stderr
- testsuite/tests/polykinds/T8616.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/73a7383ebc17f495d7acd04007c8c56b46532cb6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/73a7383ebc17f495d7acd04007c8c56b46532cb6
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200320/0f1af80b/attachment.html>


More information about the ghc-commits mailing list