diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-07-23 12:04:40 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-07-23 12:04:40 -0400 |
commit | b3743cea116fb592a8fd7937376e9f87d3f5a26e (patch) | |
tree | ec2aa235827cf17717183e0daa3e11354c729165 | |
parent | 2aaa6ed7af81c872149bfabf0761be0b253e0fc9 (diff) | |
download | haskell-wip/covar-holes.tar.gz |
Don't reuse coercion holes as covars when deferring errorswip/covar-holes
Previously TcErrors would use the variable associated with a coercion
hole as a normal coercion variable when deferring type errors. This
resulted in a Core Lint error now since we distinguish coercion holes
from "vanilla" covars via their IdDetails.
-rw-r--r-- | compiler/typecheck/TcErrors.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 02b888703d..c0343bfa15 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -898,7 +898,9 @@ addDeferredBinding ctxt err ct -> addTcEvBind ev_binds_var $ mkWantedEvBind evar err_tm HoleDest hole -> do { -- See Note [Deferred errors for coercion holes] - let co_var = coHoleCoVar hole + uniq <- newUnique + ; let co_var = mkLocalCoVar (mkSystemVarName uniq (fsLit "deferred_co")) + (varType (coHoleCoVar hole)) ; addTcEvBind ev_binds_var $ mkWantedEvBind co_var err_tm ; fillCoercionHole hole (mkTcCoVarCo co_var) }} @@ -1029,6 +1031,10 @@ from that EvVar, filling the hole with that coercion. Because coercions' types are unlifted, the error is guaranteed to be hit before we get to the coercion. +We make a new variable for the coercion so that its IdDetails say that it's +a CoVar, not a CoercionHole. (This step is very roughly like skolemisation +of TcTyVars.) + Note [Do not report derived but soluble errors] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The wc_simples include Derived constraints that have not been solved, |