import IdInfo ( GlobalIdDetails(..) )
import TcType ( tyClsNamesOfType, classNamesOfTheta )
import FieldLabel ( fieldLabelTyCon )
-import DataCon ( dataConTyCon )
+import DataCon ( dataConTyCon, dataConWrapId )
import TyCon ( visibleDataCons, isSynTyCon, getSynTyConDefn, tyConClass_maybe, tyConName )
import Class ( className, classSCTheta )
-import Name ( Name {-instance NamedThing-}, isWiredInName, isInternalName, nameModule, NamedThing(..)
- )
+import Name ( Name {-instance NamedThing-}, isWiredInName, nameIsLocalOrFrom,
+ nameModule, NamedThing(..) )
import NameEnv ( delFromNameEnv, lookupNameEnv )
import NameSet
-import Module ( Module, isHomeModule, extendModuleSet, moduleEnvElts )
+import Module ( Module, isHomeModule )
import PrelNames ( hasKey, fractionalClassKey, numClassKey,
integerTyConName, doubleTyConName )
-import FiniteMap
import Outputable
import Bag
import Maybe( fromJust )
-- Tiresomely, we must get the "main" name for the
-- thing, because that's what VSlurp contains, and what
-- is recorded in the usage information
-get_main_name (AClass cl) = className cl
+get_main_name (AClass cl) = className cl
+get_main_name (ADataCon dc) = tyConName (dataConTyCon dc)
get_main_name (ATyCon tc)
| Just clas <- tyConClass_maybe tc = get_main_name (AClass clas)
| otherwise = tyConName tc
get_main_name (AnId id)
= case globalIdDetails id of
- DataConId dc -> get_main_name (ATyCon (dataConTyCon dc))
+ DataConWorkId dc -> get_main_name (ATyCon (dataConTyCon dc))
DataConWrapId dc -> get_main_name (ATyCon (dataConTyCon dc))
RecordSelId lbl -> get_main_name (ATyCon (fieldLabelTyCon lbl))
+ GenericOpId tc -> get_main_name (ATyCon tc)
+ ClassOpId cl -> className cl
other -> idName id
= -- STEP 0: Check if it's from this module
-- Doing this catches a common case quickly
getModule `thenM` \ this_mod ->
- if isInternalName name || nameModule name == this_mod then
+ if nameIsLocalOrFrom this_mod name then
-- Variables defined on the GHCi command line (e.g. let x = 3)
-- are Internal names (which don't have a Module)
returnM AlreadySlurped
super_classes = classNamesOfTheta (classSCTheta cl)
getWiredInGates (AnId the_id) = tyClsNamesOfType (idType the_id)
+getWiredInGates (ADataCon dc) = tyClsNamesOfType (idType (dataConWrapId dc))
getWiredInGates (ATyCon tc)
| isSynTyCon tc = tyClsNamesOfType ty
| otherwise = unitFV (getName tc)
old_gates = eps_inst_gates eps
new_gates = gates `minusNameSet` old_gates
all_gates = new_gates `unionNameSets` old_gates
- orphan_mods = [mod | (mod, True, _) <- moduleEnvElts (dep_mods imports)]
+ orphan_mods = imp_orphs imports
in
loadOrphanModules orphan_mods `thenM_`
| otherwise
= getEps `thenM` \ eps ->
getInGlobalScope `thenM` \ in_type_env ->
- let
- -- Slurp rules for anything that is slurped,
+ let -- Slurp rules for anything that is slurped,
-- either now, or previously
available n = n `elemNameSet` slurped || in_type_env n
(decls, new_rules) = selectGated available (eps_rules eps)
-- Source code unchanged and no errors yet... carry on
-- First put the dependent-module info in the envt, just temporarily,
- -- so that when we look for interfaces we look for the right one.
+ -- so that when we look for interfaces we look for the right one (.hi or .hi-boot)
-- It's just temporary because either the usage check will succeed
-- (in which case we are done with this module) or it'll fail (in which
-- case we'll compile the module from scratch anyhow).
where
-- This is a bit of a hack really
- mod_deps = emptyImportAvails { dep_mods = mkModDeps (fst (mi_deps iface)) }
+ mod_deps = emptyImportAvails { imp_dep_mods = mkModDeps (dep_mods (mi_deps iface)) }
checkList :: [TcRn m RecompileRequired] -> TcRn m RecompileRequired
checkList [] = returnM upToDate