lookupOrig, lookupOrigNameCache, extendNameCache,
newIfaceName, newIfaceNames,
extendIfaceIdEnv, extendIfaceTyVarEnv,
- tcIfaceLclId, tcIfaceTyVar,
+ tcIfaceLclId, tcIfaceTyVar, lookupIfaceTyVar,
tcIfaceTick,
ifaceExportNames,
-- For source type/class decls, this is the first occurrence
-- For iface ones, the LoadIface has alrady allocated a suitable name in the cache
newImplicitBinder base_name mk_sys_occ
- = newGlobalBinder (nameModule base_name)
- (mk_sys_occ (nameOccName base_name))
- (nameSrcSpan base_name)
+ | Just mod <- nameModule_maybe base_name
+ = newGlobalBinder mod occ loc
+ | otherwise -- When typechecking a [d| decl bracket |],
+ -- TH generates types, classes etc with Internal names,
+ -- so we follow suit for the implicit binders
+ = do { uniq <- newUnique
+ ; return (mkInternalName uniq occ loc) }
+ where
+ occ = mk_sys_occ (nameOccName base_name)
+ loc = nameSrcSpan base_name
ifaceExportNames :: [IfaceExport] -> TcRnIf gbl lcl [AvailInfo]
ifaceExportNames exports = do
Nothing -> failIfM (text "Iface type variable out of scope: " <+> ppr occ)
}
+lookupIfaceTyVar :: FastString -> IfL (Maybe TyVar)
+lookupIfaceTyVar occ
+ = do { lcl <- getLclEnv
+ ; return (lookupUFM (if_tv_env lcl) occ) }
+
extendIfaceTyVarEnv :: [TyVar] -> IfL a -> IfL a
extendIfaceTyVarEnv tyvars thing_inside
= do { env <- getLclEnv