summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcHsSyn.hs
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@cs.brynmawr.edu>2018-10-28 16:06:17 -0400
committerRichard Eisenberg <rae@cs.brynmawr.edu>2018-10-28 23:17:47 -0400
commit4427315a65b25db22e1754d41b43dd4b782b022f (patch)
tree345b7293b2db9a4db36447fe469ebcc066b9a8f1 /compiler/typecheck/TcHsSyn.hs
parent5e45ad10ffca1ad175b10f6ef3327e1ed8ba25f3 (diff)
downloadhaskell-4427315a65b25db22e1754d41b43dd4b782b022f.tar.gz
Fix #15787 by squashing a coercion hole.
In type-incorrect code, we can sometimes let a coercion hole make it through the zonker. If this coercion hole then ends up in the environment (e.g., in the type of a data constructor), then it causes trouble later. This patch avoids trouble by substituting the coercion hole for its representative CoVar. Really, any coercion would do, but the CoVar was very handy. test case: polykinds/T15787
Diffstat (limited to 'compiler/typecheck/TcHsSyn.hs')
-rw-r--r--compiler/typecheck/TcHsSyn.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs
index f5fedc9d51..99e2172c5b 100644
--- a/compiler/typecheck/TcHsSyn.hs
+++ b/compiler/typecheck/TcHsSyn.hs
@@ -1810,7 +1810,9 @@ zonkCoHole env hole@(CoercionHole { ch_ref = ref, ch_co_var = cv })
, text "Type-correct unfilled coercion hole"
<+> ppr hole )
; cv' <- zonkCoVar cv
- ; return $ mkHoleCo (hole { ch_co_var = cv' }) } }
+ ; return $ mkCoVarCo cv' } }
+ -- This will be an out-of-scope variable, but keeping
+ -- this as a coercion hole led to #15787
zonk_tycomapper :: TyCoMapper ZonkEnv TcM
zonk_tycomapper = TyCoMapper