summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/mc19.stderr
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-05-26 09:31:38 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-05-26 09:32:29 +0100
commit8dc6d645fc3384b3b8ded0578939f5c855dd2ed5 (patch)
tree9a80f6b00778d4aa068a5e58265f6f57b522b134 /testsuite/tests/typecheck/should_fail/mc19.stderr
parentc2eea089e7978416c6882a5456117db27b8f45ba (diff)
downloadhaskell-8dc6d645fc3384b3b8ded0578939f5c855dd2ed5.tar.gz
Re-engineer Given flatten-skolems
The big change here is to fix an outright bug in flattening of Givens, albeit one that is very hard to exhibit. Suppose we have the constraint forall a. (a ~ F b) => ..., (forall c. ....(F b)...) ... Then - we'll flatten the (F) b to a fsk, say (F b ~ fsk1) - we'll rewrite the (F b) inside the inner implication to 'fsk1' - when we leave the outer constraint we are suppose to unflatten; but that fsk1 will still be there - if we re-simplify the entire outer implication, we'll re-flatten the Given (F b) to, say, (F b ~ fsk2) Now we have two fsks standing for the same thing, and that is very wrong. Solution: make fsks behave more like fmvs: - A flatten-skolem is now a MetaTyVar, whose MetaInfo is FlatSkolTv - We "fill in" that meta-tyvar when leaving the implication - The old FlatSkol form of TcTyVarDetails is gone completely - We track the flatten-skolems for the current implication in a new field of InertSet, inert_fsks. See Note [The flattening story] in TcFlatten. In doing this I found various other things to fix: * I removed the zonkSimples from TcFlatten.unflattenWanteds; it wasn't needed. But I added one in TcSimplify.floatEqualities, which does the zonk precisely when it is needed. * Trac #13674 showed up a case where we had - an insoluble Given, e.g. a ~ [a] - the same insoluble Wanted a ~ [a] We don't use the Given to rewwrite the Wanted (obviously), but we therefore ended up reporting Can't deduce (a ~ [a]) from (a ~ [a]) which is silly. Conclusion: when reporting errors, make the occurs check "win" See Note [Occurs check wins] in TcErrors
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/mc19.stderr')
-rw-r--r--testsuite/tests/typecheck/should_fail/mc19.stderr6
1 files changed, 1 insertions, 5 deletions
diff --git a/testsuite/tests/typecheck/should_fail/mc19.stderr b/testsuite/tests/typecheck/should_fail/mc19.stderr
index cffb7f61c5..1b9682e6c8 100644
--- a/testsuite/tests/typecheck/should_fail/mc19.stderr
+++ b/testsuite/tests/typecheck/should_fail/mc19.stderr
@@ -1,10 +1,6 @@
mc19.hs:10:31: error:
- • Couldn't match type ‘a’ with ‘[a]’
- ‘a’ is a rigid type variable bound by
- a type expected by the context:
- forall a. [a] -> [a]
- at mc19.hs:10:10-35
+ • Occurs check: cannot construct the infinite type: a ~ [a]
Expected type: [a] -> [a]
Actual type: [a] -> [[a]]
• In the expression: inits