diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2019-10-03 13:45:31 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-12 13:36:02 -0400 |
commit | 226d86d29842f894869e23ddb1197d04dacae7f7 (patch) | |
tree | 88289831c7182f1a2614462c30f91128b79b2b62 /testsuite/tests/quantified-constraints/T17267a.stderr | |
parent | c50e4c92d28752beec955d1e3486065685d2f7e6 (diff) | |
download | haskell-226d86d29842f894869e23ddb1197d04dacae7f7.tar.gz |
Do not add a 'solved dict' for quantified constraints
GHC has a wonderful-but-delicate mechanism for building recursive
dictionaries by adding a goal to the "solved dictionaries" before
solving the sub-goals. See Note [Solved dictionaries] in TcSMonad
Ticket #17267 showed that if you use this mechanism for local
/quantified/ constraints you can get a loop -- or even unsafe
coerce. This patch fixes the bug.
Specifically
* Make TcSMonad.addSolvedDict be conditional on using a
/top level/ instance, not a quantified one.
* Moreover, we /also/ don't want to add a solved dict
for equalities (a~b).
* Add lots more comments to Note [Solved dictionaries]
to explain the above cryptic stuff.
* Extend InstanceWhat to identify those strange built-in
equality instances.
A couple of other things along the way
* Delete the unused Type.isIPPred_maybe.
* Stop making addSolvedDict conditional on not being an
impolicit parameter. This comes from way back. But
it's irrelevant now because IP dicts are never solved
via an instance.
Diffstat (limited to 'testsuite/tests/quantified-constraints/T17267a.stderr')
-rw-r--r-- | testsuite/tests/quantified-constraints/T17267a.stderr | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/quantified-constraints/T17267a.stderr b/testsuite/tests/quantified-constraints/T17267a.stderr new file mode 100644 index 0000000000..c57eb1f75c --- /dev/null +++ b/testsuite/tests/quantified-constraints/T17267a.stderr @@ -0,0 +1,16 @@ + +T17267a.hs:18:12: error: + • Reduction stack overflow; size = 201 + When simplifying the following type: C a b + Use -freduction-depth=0 to disable this check + (any upper bound you could choose might fail unpredictably with + minor updates to GHC, so disabling the check is recommended if + you're sure that type checking should terminate) + • In the expression: op x + In an equation for ‘oops’: oops x = op x + In an equation for ‘uc’: + uc + = oops + where + oops :: (C a b => C a b) => a -> b + oops x = op x |