summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/tcfail103.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/typecheck/should_fail/tcfail103.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/typecheck/should_fail/tcfail103.stderr')
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail103.stderr14
1 files changed, 5 insertions, 9 deletions
diff --git a/testsuite/tests/typecheck/should_fail/tcfail103.stderr b/testsuite/tests/typecheck/should_fail/tcfail103.stderr
index 84c9c8b0b6..0a7a386f9e 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail103.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail103.stderr
@@ -1,8 +1,8 @@
-tcfail103.hs:15:13: error:
+tcfail103.hs:15:23: error:
• Couldn't match type ‘s’ with ‘t’
- Expected: ST s Int
- Actual: ST t Int
+ Expected: STRef s Int
+ Actual: STRef t Int
‘s’ is a rigid type variable bound by
the type signature for:
g :: forall s. ST s Int
@@ -11,13 +11,9 @@ tcfail103.hs:15:13: error:
the type signature for:
f :: forall t. ST t Int
at tcfail103.hs:10:1-12
- • In the expression: readSTRef v
+ • In the first argument of ‘readSTRef’, namely ‘v’
+ In the expression: readSTRef v
In an equation for ‘g’: g = readSTRef v
- In the expression:
- do v <- newSTRef 5
- let g :: ST s Int
- g = readSTRef v
- g
• Relevant bindings include
g :: ST s Int (bound at tcfail103.hs:15:9)
v :: STRef t Int (bound at tcfail103.hs:12:5)