summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/T3169.stderr
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-02-15 22:36:16 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-01 17:30:21 -0500
commit7730713b747e66c93b4fe45478981a6e2ebfc7e2 (patch)
tree64301948eb33d227cfc01aa57be2fdda60a2c13c /testsuite/tests/gadt/T3169.stderr
parent8c425bd83b3d622cd055ad015daca3539a6670de (diff)
downloadhaskell-7730713b747e66c93b4fe45478981a6e2ebfc7e2.tar.gz
Unify result type earlier to improve error messages
Ticket #19364 helpfully points out that we do not currently take advantage of pushing the result type of an application into the arguments. This makes error messages notably less good. The fix is rather easy: move the result-type unification step earlier. It's even a bit more efficient; in the the checking case we now do one less zonk. See Note [Unify with expected type before typechecking arguments] in GHC.Tc.Gen.App This change generally improves error messages, but it made one worse: typecheck/should_fail/T16204c. That led me to the realisation that a good error can be replaced by a less-good one, which provoked me to change GHC.Tc.Solver.Interact.inertsCanDischarge. It's explained in the new Note [Combining equalities] One other refactoring: I discovered that KindEqOrigin didn't need a Maybe in its type -- a nice simplification.
Diffstat (limited to 'testsuite/tests/gadt/T3169.stderr')
-rw-r--r--testsuite/tests/gadt/T3169.stderr13
1 files changed, 5 insertions, 8 deletions
diff --git a/testsuite/tests/gadt/T3169.stderr b/testsuite/tests/gadt/T3169.stderr
index 3a5fc99fb3..5770e03c70 100644
--- a/testsuite/tests/gadt/T3169.stderr
+++ b/testsuite/tests/gadt/T3169.stderr
@@ -1,20 +1,17 @@
-T3169.hs:13:13: error:
+T3169.hs:13:22: error:
• Couldn't match type ‘elt’ with ‘Map b elt’
- Expected: Maybe (Map b elt)
- Actual: Maybe elt
+ Expected: Map a (Map b elt)
+ Actual: Map (a, b) elt
‘elt’ is a rigid type variable bound by
the type signature for:
lookup :: forall elt. (a, b) -> Map (a, b) elt -> Maybe elt
at T3169.hs:12:3-8
- • In the expression: lookup a m :: Maybe (Map b elt)
+ • In the second argument of ‘lookup’, namely ‘m’
+ In the expression: lookup a m :: Maybe (Map b elt)
In the expression:
case lookup a m :: Maybe (Map b elt) of {
Just (m2 :: Map b elt) -> lookup b m2 :: Maybe elt }
- In an equation for ‘lookup’:
- lookup (a, b) (m :: Map (a, b) elt)
- = case lookup a m :: Maybe (Map b elt) of {
- Just (m2 :: Map b elt) -> lookup b m2 :: Maybe elt }
• Relevant bindings include
m :: Map (a, b) elt (bound at T3169.hs:12:17)
b :: b (bound at T3169.hs:12:13)