[Git][ghc/ghc][wip/no-coholes] Simplify treatment of heterogeneous equality

Richard Eisenberg gitlab at gitlab.haskell.org
Wed Mar 18 13:26:23 UTC 2020



Richard Eisenberg pushed to branch wip/no-coholes at Glasgow Haskell Compiler / GHC


Commits:
11ea299e by Richard Eisenberg at 2020-03-18T13:26:08Z
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/11ea299ea4f079c5e2ec7eb859dcde6f900902b5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/11ea299ea4f079c5e2ec7eb859dcde6f900902b5
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/20200318/2cc6944c/attachment-0001.html>


More information about the ghc-commits mailing list