summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Solver/InertSet.hs
diff options
context:
space:
mode:
authorRichard Eisenberg <richard.eisenberg@tweag.io>2022-05-13 15:15:10 -0400
committerRichard Eisenberg <rae@richarde.dev>2022-05-26 02:42:57 +0000
commitf2814d14b32f7fd732691cd1c1f682692ca8c0fc (patch)
tree5de06187b03c4507ea2a2be8a3dea1e85e82aa6f /compiler/GHC/Tc/Solver/InertSet.hs
parent5678f017a69dc758d0edabbdaad755bd5efef465 (diff)
downloadhaskell-wip/T21515.tar.gz
Generalize breakTyVarCycle to work with TyFamLHSwip/T21515
The function breakTyVarCycle_maybe has been installed in a dark corner of GHC to catch some gremlins (a.k.a. occurs-check failures) who lurk there. But it previously only caught gremlins of the form (a ~ ... F a ...), where some of our intrepid users have spawned gremlins of the form (G a ~ ... F (G a) ...). This commit improves breakTyVarCycle_maybe (and renames it to breakTyEqCycle_maybe) to catch the new gremlins. Happily, the change is remarkably small. The gory details are in Note [Type equality cycles]. Test cases: typecheck/should_compile/{T21515,T21473}.
Diffstat (limited to 'compiler/GHC/Tc/Solver/InertSet.hs')
-rw-r--r--compiler/GHC/Tc/Solver/InertSet.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Solver/InertSet.hs b/compiler/GHC/Tc/Solver/InertSet.hs
index f7d0eb0701..4de3ca8d1f 100644
--- a/compiler/GHC/Tc/Solver/InertSet.hs
+++ b/compiler/GHC/Tc/Solver/InertSet.hs
@@ -240,7 +240,7 @@ type CycleBreakerVarStack = NonEmpty [(TcTyVar, TcType)]
-- first element in the stack corresponds to current implication;
-- later elements correspond to outer implications
-- used to undo the cycle-breaking needed to handle
- -- Note [Type variable cycles] in GHC.Tc.Solver.Canonical
+ -- Note [Type equality cycles] in GHC.Tc.Solver.Canonical
-- Why store the outer implications? For the use in mightEqualLater (only)
data InertSet
@@ -1693,7 +1693,7 @@ This is best understood by example.
where cbv = F a
The cbv is a cycle-breaker var which stands for F a. See
- Note [Type variable cycles] in GHC.Tc.Solver.Canonical.
+ Note [Type equality cycles] in GHC.Tc.Solver.Canonical.
This is just like case 6, and we say "no". Saying "no" here is
essential in getting the parser to type-check, with its use of DisambECP.