summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2fa402d)
Workers get local names initially; nuke mkDerivedName
import Class ( Class, classTyCon, classTyVars, classSelIds )
import Var ( Id, TyVar )
import VarSet ( isEmptyVarSet )
import Class ( Class, classTyCon, classTyVars, classSelIds )
import Var ( Id, TyVar )
import VarSet ( isEmptyVarSet )
-import Name ( mkDerivedName, mkWiredInName, mkLocalName,
+import Name ( mkWiredInName, mkLocalName,
mkWorkerOcc, mkCCallName,
mkWorkerOcc, mkCCallName,
+ Name, NamedThing(..), getSrcLoc
)
import OccName ( mkVarOcc )
import PrimOp ( PrimOp(DataToTagOp, CCallOp),
)
import OccName ( mkVarOcc )
import PrimOp ( PrimOp(DataToTagOp, CCallOp),
-- type is wired-in (see comment at TcClassDcl.tcClassSig), so
-- do not generalise it
-- type is wired-in (see comment at TcClassDcl.tcClassSig), so
-- do not generalise it
+mkWorkerId :: Unique -> Id -> Type -> Id
+-- A worker gets a local name. CoreTidy will globalise it if necessary.
mkWorkerId uniq unwrkr ty
mkWorkerId uniq unwrkr ty
- = mkVanillaId (mkDerivedName mkWorkerOcc (getName unwrkr) uniq) ty
+ = mkVanillaId wkr_name ty
+ where
+ wkr_name = mkLocalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr)
\end{code}
%************************************************************************
\end{code}
%************************************************************************
Name, -- Abstract
mkLocalName, mkSysLocalName, mkCCallName,
mkIPName,
Name, -- Abstract
mkLocalName, mkSysLocalName, mkCCallName,
mkIPName,
- mkDerivedName, mkGlobalName, mkKnownKeyGlobal, mkWiredInName,
+ mkGlobalName, mkKnownKeyGlobal, mkWiredInName,
nameUnique, setNameUnique,
nameOccName, nameModule, nameModule_maybe,
nameUnique, setNameUnique,
nameOccName, nameModule, nameModule_maybe,
n_sort = Local,
n_occ = occ,
n_loc = noSrcLoc }
n_sort = Local,
n_occ = occ,
n_loc = noSrcLoc }
-
----------------------------------------------------------------------
-mkDerivedName :: (OccName -> OccName)
- -> Name -- Base name
- -> Unique -- New unique
- -> Name -- Result is always a value name
-
-mkDerivedName f name uniq = name {n_uniq = uniq, n_occ = f (n_occ name)}
-- These two are used when parsing source files
-- They do encode the module and occurrence names
-- These two are used when parsing source files
-- They do encode the module and occurrence names
-mkUnqual :: NameSpace -> FAST_STRING -> RdrName
+mkUnqual :: NameSpace -> UserFS -> RdrName
mkUnqual sp n = RdrName Unqual (mkOccFS sp n)
mkQual :: NameSpace -> (UserFS, UserFS) -> RdrName
mkUnqual sp n = RdrName Unqual (mkOccFS sp n)
mkQual :: NameSpace -> (UserFS, UserFS) -> RdrName
import TysWiredIn ( voidTy )
import Name ( Name, NamedThing(..), setNameUnique, mkSysLocalName,
import TysWiredIn ( voidTy )
import Name ( Name, NamedThing(..), setNameUnique, mkSysLocalName,
- mkDerivedName, mkDerivedTyConOcc
+ mkLocalName, mkDerivedTyConOcc
)
import Unique ( Uniquable(..) )
)
import Unique ( Uniquable(..) )
+import SrcLoc ( noSrcLoc )
import Util ( nOfThem )
import Outputable
\end{code}
import Util ( nOfThem )
import Outputable
\end{code}
mk_void_tycon tv kind -- Make a new TyCon with the same kind as the
-- type variable tv. Same name too, apart from
-- making it start with a colon (sigh)
mk_void_tycon tv kind -- Make a new TyCon with the same kind as the
-- type variable tv. Same name too, apart from
-- making it start with a colon (sigh)
- = mkPrimTyCon tc_name kind 0 [] VoidRep
+ -- I dread to think what will happen if this gets out into an
+ -- interface file. Catastrophe likely. Major sigh.
+ = pprTrace "Urk! Inventing strangely-kinded void TyCon" (ppr tc_name) $
+ mkPrimTyCon tc_name kind 0 [] VoidRep
- tc_name = mkDerivedName mkDerivedTyConOcc (getName tv) (getUnique tv)
+ tc_name = mkLocalName (getUnique tv) (mkDerivedTyConOcc (getOccName tv)) noSrcLoc
-- zonkTcTyVarToTyVar is applied to the *binding* occurrence
-- of a type variable, at the *end* of type checking. It changes
-- zonkTcTyVarToTyVar is applied to the *binding* occurrence
-- of a type variable, at the *end* of type checking. It changes