[project @ 1998-09-30 07:52:04 by sof]
authorsof <unknown>
Wed, 30 Sep 1998 07:52:04 +0000 (07:52 +0000)
committersof <unknown>
Wed, 30 Sep 1998 07:52:04 +0000 (07:52 +0000)
merged from new-rts: permit unsafeCoerce# to be applied to values with an unboxed type

ghc/compiler/prelude/PrelVals.lhs

index 1aea62c..733c49b 100644 (file)
@@ -23,7 +23,7 @@ import CoreSyn                -- quite a bit
 import IdInfo          -- quite a bit
 import Name            ( mkWiredInIdName, Module )
 import Type            
-import TyVar           ( openAlphaTyVar, alphaTyVar, betaTyVar, TyVar )
+import TyVar           ( openAlphaTyVar, openAlphaTyVars, alphaTyVar, betaTyVar, TyVar )
 import Unique          -- lots of *Keys
 import Util            ( panic )
 \end{code}
@@ -125,10 +125,14 @@ unsafeCoerceId
   = pcMiscPrelId unsafeCoerceIdKey pREL_GHC SLIT("unsafeCoerce#") ty
        (mk_inline_unfolding template)
   where
-    ty = mkForAllTys [alphaTyVar,betaTyVar] (mkFunTy alphaTy betaTy)
-    [x] = mkTemplateLocals [alphaTy]
-    template = mkLam [alphaTyVar,betaTyVar] [x] (
-                 Note (Coerce betaTy alphaTy) (Var x))
+     (alphaTyVar:betaTyVar:_) = openAlphaTyVars
+     alphaTy  = mkTyVarTy alphaTyVar
+     betaTy   = mkTyVarTy betaTyVar
+     ty = mkForAllTys [alphaTyVar,betaTyVar] (mkFunTy alphaTy betaTy)
+     [x] = mkTemplateLocals [alphaTy]
+     template = mkLam [alphaTyVar,betaTyVar] [x] $
+              Note (Coerce betaTy alphaTy) (Var x)
+
 \end{code}
 
 We want \tr{GHCbase.trace} to be wired in