Commit 294ac47e authored by eir@cis.upenn.edu's avatar eir@cis.upenn.edu
Browse files

Fix #9788 by giving `coerce` the right type.

No test case added, as the original mistake is just one level
up from a typo.
parent 90a2bb6f
......@@ -1146,17 +1146,14 @@ coerceId = pcMiscPrelId coerceName ty info
where
info = noCafIdInfo `setInlinePragInfo` alwaysInlinePragma
`setUnfoldingInfo` mkCompulsoryUnfolding rhs
kv = kKiVar
k = mkTyVarTy kv
a:b:_ = tyVarList k
[aTy,bTy] = map mkTyVarTy [a,b]
eqRTy = mkTyConApp coercibleTyCon [k, aTy, bTy]
eqRPrimTy = mkTyConApp eqReprPrimTyCon [k, aTy, bTy]
ty = mkForAllTys [kv, a, b] (mkFunTys [eqRTy, aTy] bTy)
[eqR,x,eq] = mkTemplateLocals [eqRTy, aTy,eqRPrimTy]
rhs = mkLams [kv,a,b,eqR,x] $
mkWildCase (Var eqR) eqRTy bTy $
eqRTy = mkTyConApp coercibleTyCon [liftedTypeKind, alphaTy, betaTy]
eqRPrimTy = mkTyConApp eqReprPrimTyCon [liftedTypeKind, alphaTy, betaTy]
ty = mkForAllTys [alphaTyVar, betaTyVar] $
mkFunTys [eqRTy, alphaTy] betaTy
[eqR,x,eq] = mkTemplateLocals [eqRTy, alphaTy, eqRPrimTy]
rhs = mkLams [alphaTyVar, betaTyVar, eqR, x] $
mkWildCase (Var eqR) eqRTy betaTy $
[(DataAlt coercibleDataCon, [eq], Cast (Var x) (CoVarCo eq))]
\end{code}
......
type role Coercible representational representational
class Coercible (a :: k) (b :: k)
-- Defined in ‘GHC.Types’
coerce ::
forall (k :: BOX) (a :: k) (b :: k). Coercible a b => a -> b
-- Defined in ‘GHC.Prim’
coerce :: Coercible a b => a -> b -- Defined in ‘GHC.Prim’
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment