summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T14350.stderr
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@cs.brynmawr.edu>2017-09-04 22:27:17 +0100
committerRichard Eisenberg <rae@cs.brynmawr.edu>2018-03-31 23:16:46 -0400
commitfaec8d358985e5d0bf363bd96f23fe76c9e281f7 (patch)
tree9aebd4566f5787dbbe08ca8fd9dc720958610345 /testsuite/tests/typecheck/should_fail/T14350.stderr
parentca535f95a742d885c4082c9dc296c151fb3c1e12 (diff)
downloadhaskell-faec8d358985e5d0bf363bd96f23fe76c9e281f7.tar.gz
Track type variable scope more carefully.
The main job of this commit is to track more accurately the scope of tyvars introduced by user-written foralls. For example, it would be to have something like this: forall a. Int -> (forall k (b :: k). Proxy '[a, b]) -> Bool In that type, a's kind must be k, but k isn't in scope. We had a terrible way of doing this before (not worth repeating or describing here, but see the old tcImplicitTKBndrs and friends), but now we have a principled approach: make an Implication when kind-checking a forall. Doing so then hooks into the existing machinery for preventing skolem-escape, performing floating, etc. This also means that we bump the TcLevel whenever going into a forall. The new behavior is done in TcHsType.scopeTyVars, but see also TcHsType.tc{Im,Ex}plicitTKBndrs, which have undergone significant rewriting. There are several Notes near there to guide you. Of particular interest there is that Implication constraints can now have skolems that are out of order; this situation is reported in TcErrors. A major consequence of this is a slightly tweaked process for type- checking type declarations. The new Note [Use SigTvs in kind-checking pass] in TcTyClsDecls lays it out. The error message for dependent/should_fail/TypeSkolEscape has become noticeably worse. However, this is because the code in TcErrors goes to some length to preserve pre-8.0 error messages for kind errors. It's time to rip off that plaster and get rid of much of the kind-error-specific error messages. I tried this, and doing so led to a lovely error message for TypeSkolEscape. So: I'm accepting the error message quality regression for now, but will open up a new ticket to fix it, along with a larger error-message improvement I've been pondering. This applies also to dependent/should_fail/{BadTelescope2,T14066,T14066e}, polykinds/T11142. Other minor changes: - isUnliftedTypeKind didn't look for tuples and sums. It does now. - check_type used check_arg_type on both sides of an AppTy. But the left side of an AppTy isn't an arg, and this was causing a bad error message. I've changed it to use check_type on the left-hand side. - Some refactoring around when we print (TYPE blah) in error messages. The changes decrease the times when we do so, to good effect. Of course, this is still all controlled by -fprint-explicit-runtime-reps Fixes #14066 #14749 Test cases: dependent/should_compile/{T14066a,T14749}, dependent/should_fail/T14066{,c,d,e,f,g,h}
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T14350.stderr')
-rw-r--r--testsuite/tests/typecheck/should_fail/T14350.stderr27
1 files changed, 14 insertions, 13 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T14350.stderr b/testsuite/tests/typecheck/should_fail/T14350.stderr
index 27b53aa73d..258518e9be 100644
--- a/testsuite/tests/typecheck/should_fail/T14350.stderr
+++ b/testsuite/tests/typecheck/should_fail/T14350.stderr
@@ -1,18 +1,19 @@
T14350.hs:59:15: error:
• Couldn't match expected type ‘Proxy a2
- -> Apply (Apply (c1 x5) 'Proxy) (Apply (g x5) 'Proxy)’
- with actual type ‘Sing (f0 @@ t0)’
+ -> Apply (Apply (c x3) 'Proxy) (Apply (g x3) 'Proxy)’
+ with actual type ‘Sing (f x y @@ t0)’
• The function ‘applySing’ is applied to three arguments,
- but its type ‘Sing f0 -> Sing t0 -> Sing (f0 @@ t0)’ has only two
+ but its type ‘Sing (f x y) -> Sing t0 -> Sing (f x y @@ t0)’
+ has only two
In the expression: applySing f Proxy Proxy
In an equation for ‘dcomp’: dcomp f g x = applySing f Proxy Proxy
• Relevant bindings include
- x :: Sing x5 (bound at T14350.hs:59:11)
- g :: Sing (g x4) (bound at T14350.hs:59:9)
- f :: Sing (f x3 y1) (bound at T14350.hs:59:7)
- dcomp :: Sing (f x3 y1)
- -> Sing (g x4) -> Sing x5 -> (c1 x5 @@ 'Proxy) @@ (g x5 @@ 'Proxy)
+ x :: Sing x3 (bound at T14350.hs:59:11)
+ g :: Sing (g x2) (bound at T14350.hs:59:9)
+ f :: Sing (f x1 y) (bound at T14350.hs:59:7)
+ dcomp :: Sing (f x1 y)
+ -> Sing (g x2) -> Sing x3 -> (c x3 @@ 'Proxy) @@ (g x3 @@ 'Proxy)
(bound at T14350.hs:59:1)
T14350.hs:59:27: error:
@@ -22,9 +23,9 @@ T14350.hs:59:27: error:
In the expression: applySing f Proxy Proxy
In an equation for ‘dcomp’: dcomp f g x = applySing f Proxy Proxy
• Relevant bindings include
- x :: Sing x5 (bound at T14350.hs:59:11)
- g :: Sing (g x4) (bound at T14350.hs:59:9)
- f :: Sing (f x3 y1) (bound at T14350.hs:59:7)
- dcomp :: Sing (f x3 y1)
- -> Sing (g x4) -> Sing x5 -> (c1 x5 @@ 'Proxy) @@ (g x5 @@ 'Proxy)
+ x :: Sing x3 (bound at T14350.hs:59:11)
+ g :: Sing (g x2) (bound at T14350.hs:59:9)
+ f :: Sing (f x1 y) (bound at T14350.hs:59:7)
+ dcomp :: Sing (f x1 y)
+ -> Sing (g x2) -> Sing x3 -> (c x3 @@ 'Proxy) @@ (g x3 @@ 'Proxy)
(bound at T14350.hs:59:1)