[commit: ghc] master: Improve error messages around kind mismatches. (8e15e3d)
Simon Peyton Jones
simonpj at microsoft.com
Thu Jul 27 12:01:24 UTC 2017
| typecheck/should_fail/T7368) Solution: track the provenance of
| Derived constraints and refuse to float out a constraint that has
| an insoluble Derived.
For the record, that's not the solution that the patch implements. Instead we just don’t float heterogeneous equalities.
I think Richard just forgot to update the commit message.
Simon
| -----Original Message-----
| From: ghc-commits [mailto:ghc-commits-bounces at haskell.org] On Behalf
| Of git at git.haskell.org
| Sent: 27 July 2017 12:50
| To: ghc-commits at haskell.org
| Subject: [commit: ghc] master: Improve error messages around kind
| mismatches. (8e15e3d)
|
| Repository : ssh://git@git.haskell.org/ghc
|
| On branch : master
| Link :
| https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fghc.ha
| skell.org%2Ftrac%2Fghc%2Fchangeset%2F8e15e3d370e9c253ae0dbb330e25b72cb
| 00cdb76%2Fghc&data=02%7C01%7Csimonpj%40microsoft.com%7C9993301a429e467
| e29b008d4d4e6350f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6363675
| 32584262688&sdata=bY%2Bruj0hhXfC23hfMA1ivuAs2Av2%2BY4%2BJK2yyCoPzbA%3D
| &reserved=0
|
| >---------------------------------------------------------------
|
| commit 8e15e3d370e9c253ae0dbb330e25b72cb00cdb76
| Author: Richard Eisenberg <rae at cs.brynmawr.edu>
| Date: Thu Jun 1 17:27:14 2017 -0400
|
| Improve error messages around kind mismatches.
|
| Previously, when canonicalizing (or unifying, in uType) a
| heterogeneous equality, we emitted a kind equality and used the
| resulting coercion to cast one side of the heterogeneous equality.
|
| While sound, this led to terrible error messages. (See the bugs
| listed below.) The problem is that using the coercion built from
| the emitted kind equality is a bit like a wanted rewriting a
| wanted.
| The solution is to keep heterogeneous equalities as irreducible.
|
| See Note [Equalities with incompatible kinds] in TcCanonical.
|
| This commit also removes a highly suspicious switch to
| FM_SubstOnly
| when flattening in the kinds of a type variable. I have no idea
| why this was there, other than as a holdover from pre-TypeInType.
| I've not left a Note because there is simply no reason I can
| conceive
| of that the FM_SubstOnly should be there.
|
| One challenge with this patch is that the emitted derived
| equalities
| might get emitted several times: when a heterogeneous equality is
| in an implication and then gets floated out from the implication,
| the Derived is present both in and out of the implication. This
| causes a duplicate error message. (Test case:
| typecheck/should_fail/T7368) Solution: track the provenance of
| Derived constraints and refuse to float out a constraint that has
| an insoluble Derived.
|
| Lastly, this labels one test (dependent/should_fail/RAE_T32a)
| as expect_broken, because the problem is really #12919. The
| different handling of constraints in this patch exposes the error.
|
| This fixes bugs #11198, #12373, #13530, and #13610.
|
| test cases:
| typecheck/should_fail/{T8262,T8603,tcail122,T12373,T13530,T13610}
|
|
| >---------------------------------------------------------------
|
| 8e15e3d370e9c253ae0dbb330e25b72cb00cdb76
| compiler/typecheck/TcCanonical.hs | 296
| ++++++++++++---------
| compiler/typecheck/TcErrors.hs | 75 ++++--
| compiler/typecheck/TcEvidence.hs | 8 +-
| compiler/typecheck/TcFlatten.hs | 31 ++-
| compiler/typecheck/TcRnTypes.hs | 30 ++-
| compiler/typecheck/TcSimplify.hs | 34 ++-
| compiler/typecheck/TcType.hs | 10 +-
| compiler/typecheck/TcUnify.hs | 28 +-
| compiler/types/Type.hs | 4 +-
| testsuite/tests/dependent/should_fail/T11471.hs | 2 +-
| .../tests/dependent/should_fail/T11471.stderr | 11 +-
| testsuite/tests/dependent/should_fail/all.T | 2 +-
| testsuite/tests/gadt/gadt7.stderr | 6 +-
| .../tests/ghci.debugger/scripts/break012.stdout | 14 +-
| .../indexed-types/should_fail/ExtraTcsUntch.stderr | 6 +-
| .../tests/indexed-types/should_fail/T5934.stderr | 13 -
| testsuite/tests/polykinds/T12593.stderr | 56 ++++
| testsuite/tests/polykinds/T13555.stderr | 21 +-
| testsuite/tests/polykinds/T7438.stderr | 6 +-
| testsuite/tests/polykinds/T8566.stderr | 2 +-
| testsuite/tests/polykinds/T9017.stderr | 10 +-
| testsuite/tests/typecheck/should_fail/T12373.hs | 10 +
| .../tests/typecheck/should_fail/T12373.stderr | 8 +
| testsuite/tests/typecheck/should_fail/T13530.hs | 11 +
| .../tests/typecheck/should_fail/T13530.stderr | 7 +
| testsuite/tests/typecheck/should_fail/T13610.hs | 11 +
| .../tests/typecheck/should_fail/T13610.stderr | 14 +
| testsuite/tests/typecheck/should_fail/T5691.stderr | 10 +-
| testsuite/tests/typecheck/should_fail/T7368.stderr | 6 +-
| .../tests/typecheck/should_fail/T7368a.stderr | 2 +-
| testsuite/tests/typecheck/should_fail/T7453.stderr | 48 +---
| testsuite/tests/typecheck/should_fail/T7696.stderr | 4 +-
| testsuite/tests/typecheck/should_fail/T8262.stderr | 6 +-
| testsuite/tests/typecheck/should_fail/T8603.hs | 4 +
| testsuite/tests/typecheck/should_fail/T8603.stderr | 13 +-
| testsuite/tests/typecheck/should_fail/all.T | 3 +
| .../tests/typecheck/should_fail/tcfail090.stderr | 4 +-
| .../tests/typecheck/should_fail/tcfail122.stderr | 8 +-
| .../tests/typecheck/should_fail/tcfail123.stderr | 13 +-
| .../tests/typecheck/should_fail/tcfail200.stderr | 6 +-
| 40 files changed, 537 insertions(+), 316 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
| 8e15e3d370e9c253ae0dbb330e25b72cb00cdb76
| _______________________________________________
| ghc-commits mailing list
| ghc-commits at haskell.org
| https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h
| askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
| commits&data=02%7C01%7Csimonpj%40microsoft.com%7C9993301a429e467e29b00
| 8d4d4e6350f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6363675325842
| 62688&sdata=JkrPJNfzdjx2Rz%2FfcMq2HlIP%2BlsFIE%2FT68a%2FSUae%2Fzo%3D&r
| eserved=0
More information about the ghc-devs
mailing list