summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2019-02-14 08:28:43 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2019-02-14 08:40:03 +0000
commit5c1f268e2744fab2d36e64c163858995451d7095 (patch)
treecb9b05c9112e6df43d90f28b6e3a252b2a077d46 /testsuite/tests/indexed-types
parent682783828275cca5fd8bf5be5b52054c75e0e22c (diff)
downloadhaskell-5c1f268e2744fab2d36e64c163858995451d7095.tar.gz
Fail fast in solveLocalEqualities
This patch makes us fail fast in TcSimplify.solveLocalEqualities, and in TcHsType.tc_hs_sig_type, if there are insoluble constraints. Previously we ploughed on even if there were insoluble constraints, leading to a cascade of hard-to-understand type errors. Failing eagerly is much better; hence a lot of testsuite error message changes. Eg if we have f :: [Maybe] -> blah f xs = e then trying typecheck 'f x = e' with an utterly bogus type is just asking for trouble. I can't quite remember what provoked me to make this change, but I think the error messages are notably improved, by removing confusing clutter and focusing on the real error.
Diffstat (limited to 'testsuite/tests/indexed-types')
-rw-r--r--testsuite/tests/indexed-types/should_fail/T13877.stderr22
1 files changed, 2 insertions, 20 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T13877.stderr b/testsuite/tests/indexed-types/should_fail/T13877.stderr
index 9dc8534ca1..674b258c24 100644
--- a/testsuite/tests/indexed-types/should_fail/T13877.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T13877.stderr
@@ -1,25 +1,7 @@
-T13877.hs:65:17: error:
- • Couldn't match type ‘Apply p (x : xs)’ with ‘p (x : xs)’
- Expected type: Sing x
- -> Sing xs
- -> App [a1] (':->) * p xs
- -> App [a1] (':->) * p (x : xs)
- Actual type: Sing x -> Sing xs -> (p @@ xs) -> p @@ (x : xs)
- • In the expression: listElimPoly @(:->) @a @p @l
- In an equation for ‘listElimTyFun’:
- listElimTyFun = listElimPoly @(:->) @a @p @l
- • Relevant bindings include
- listElimTyFun :: Sing l
- -> (p @@ '[])
- -> (forall (x :: a1) (xs :: [a1]).
- Sing x -> Sing xs -> (p @@ xs) -> p @@ (x : xs))
- -> p @@ l
- (bound at T13877.hs:65:1)
-
T13877.hs:65:41: error:
• Expecting one more argument to ‘p’
- Expected kind ‘(-?>) [a1] * (':->)’, but ‘p’ has kind ‘[a1] ~> *’
+ Expected kind ‘(-?>) [a] * (':->)’, but ‘p’ has kind ‘[a] ~> *’
• In the type ‘p’
In the expression: listElimPoly @(:->) @a @p @l
In an equation for ‘listElimTyFun’:
@@ -27,7 +9,7 @@ T13877.hs:65:41: error:
• Relevant bindings include
listElimTyFun :: Sing l
-> (p @@ '[])
- -> (forall (x :: a1) (xs :: [a1]).
+ -> (forall (x :: a) (xs :: [a]).
Sing x -> Sing xs -> (p @@ xs) -> p @@ (x : xs))
-> p @@ l
(bound at T13877.hs:65:1)