Skip to content

Commit

Permalink
supercast -> superCast, classcast -> unsafeCast
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulmutt committed Oct 13, 2016
1 parent 9e0700b commit cfd5914
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions compiler/GHCVM/DeSugar/DsForeign.hs
Expand Up @@ -202,8 +202,8 @@ unboxArg vs arg

getClassCastId :: Bound -> DsM Id
getClassCastId bound
| bound == ExtendsBound = dsLookupGlobalId supercastName
| otherwise = dsLookupGlobalId classcastName
| bound == ExtendsBound = dsLookupGlobalId superCastName
| otherwise = dsLookupGlobalId unsafeCastName

mkFCall :: DynFlags -> Unique -> ForeignCall -> [CoreExpr] -> Type -> CoreExpr
mkFCall dflags unique fcall valArgs resType
Expand Down
16 changes: 8 additions & 8 deletions compiler/GHCVM/Prelude/PrelNames.hs
Expand Up @@ -370,8 +370,8 @@ basicKnownKeyNames
, javaTyConName
, javaDataConName
, extendsClassName
, supercastName
, classcastName
, superCastName
, unsafeCastName
]

genericTyConNames :: [Name]
Expand Down Expand Up @@ -1230,12 +1230,12 @@ fingerprintDataConName =
conName gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey

-- GHCVM-specific names
javaTyConName, javaDataConName, extendsClassName, supercastName :: Name
javaTyConName, javaDataConName, extendsClassName, superCastName :: Name
javaTyConName = tcQual gHC_TYPES (fsLit "Java") javaTyConKey
javaDataConName = conName gHC_TYPES (fsLit "Java") javaDataConKey
extendsClassName = clsQual gHC_CLASSES (fsLit "Extends") extendsClassKey
supercastName = varQual gHC_CLASSES (fsLit "supercast") supercastClassOpKey
classcastName = varQual gHC_CLASSES (fsLit "classcast") classcastClassOpKey
superCastName = varQual gHC_CLASSES (fsLit "superCast") superCastClassOpKey
unsafeCastName = varQual gHC_CLASSES (fsLit "unsafeCast") unsafeCastClassOpKey

{-
************************************************************************
Expand Down Expand Up @@ -1972,9 +1972,9 @@ toListClassOpKey = mkPreludeMiscIdUnique 501
proxyHashKey :: Unique
proxyHashKey = mkPreludeMiscIdUnique 502
-- GHCVM-specific
supercastClassOpKey, classcastClassOpKey :: Unique
supercastClassOpKey = mkPreludeMiscIdUnique 200
classcastClassOpKey = mkPreludeMiscIdUnique 201
superCastClassOpKey, unsafeCastClassOpKey :: Unique
superCastClassOpKey = mkPreludeMiscIdUnique 200
unsafeCastClassOpKey = mkPreludeMiscIdUnique 201

---------------- Template Haskell -------------------
-- USES IdUniques 200-499
Expand Down
20 changes: 10 additions & 10 deletions libraries/ghc-prim/GHC/Classes.hs
Expand Up @@ -317,18 +317,18 @@ instance Class JString where
type family Super (a :: *) :: *

class (Class a, Class b) => Extends a b where
supercast :: a -> b
{-# INLINE supercast #-}
supercast x = obj (unsafeCoerce# (unobj x))
classcast :: b -> a
{-# INLINE classcast #-}
classcast x = obj (classCast# (unobj x))
superCast :: a -> b
{-# INLINE superCast #-}
superCast x = obj (unsafeCoerce# (unobj x))
unsafeCast :: b -> a
{-# INLINE unsafeCast #-}
unsafeCast x = obj (classCast# (unobj x))

instance Class a => Extends a a where
{-# INLINE supercast #-}
supercast x = x
{-# INLINE classcast #-}
classcast x = x
{-# INLINE superCast #-}
superCast x = x
{-# INLINE unsafeCast #-}
unsafeCast x = x

instance {-# INCOHERENT #-} (Class a, Super a ~ b, Extends b c) => Extends a c where

0 comments on commit cfd5914

Please sign in to comment.