summaryrefslogtreecommitdiff
path: root/compiler/main
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main')
-rw-r--r--compiler/main/HscMain.hs13
-rw-r--r--compiler/main/HscTypes.hs13
2 files changed, 10 insertions, 16 deletions
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 95cb5f222f..64143e0c03 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -94,11 +94,9 @@ import BasicTypes ( HValue )
import ByteCodeGen ( byteCodeGen, coreExprToBCOs )
import Linker
import CoreTidy ( tidyExpr )
-import Type ( Type )
-import {- Kind parts of -} Type ( Kind )
+import Type ( Type, Kind )
import CoreLint ( lintInteractiveExpr )
import VarEnv ( emptyTidyEnv )
-import THNames ( templateHaskellNames )
import ConLike
import GHC.Exts
@@ -183,7 +181,7 @@ newHscEnv :: DynFlags -> IO HscEnv
newHscEnv dflags = do
eps_var <- newIORef initExternalPackageState
us <- mkSplitUniqSupply 'r'
- nc_var <- newIORef (initNameCache us allKnownKeyNames)
+ nc_var <- newIORef (initNameCache us knownKeyNames)
fc_var <- newIORef emptyModuleEnv
return HscEnv { hsc_dflags = dflags,
hsc_targets = [],
@@ -196,13 +194,6 @@ newHscEnv dflags = do
hsc_type_env_var = Nothing }
-allKnownKeyNames :: [Name] -- Put here to avoid loops involving DsMeta,
-allKnownKeyNames = -- where templateHaskellNames are defined
- knownKeyNames
-#ifdef GHCI
- ++ templateHaskellNames
-#endif
-
-- -----------------------------------------------------------------------------
getWarnings :: Hsc WarningMessages
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index b711ffea51..fb65a67e6e 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -1689,8 +1689,8 @@ implicitTyThings (AConLike cl) = implicitConLikeThings cl
implicitConLikeThings :: ConLike -> [TyThing]
implicitConLikeThings (RealDataCon dc)
- = dataConImplicitTyThings dc
-
+ = map AnId (dataConImplicitIds dc)
+ -- For data cons add the worker and (possibly) wrapper
implicitConLikeThings (PatSynCon {})
= [] -- Pattern synonyms have no implicit Ids; the wrapper and matcher
-- are not "implicit"; they are simply new top-level bindings,
@@ -1705,7 +1705,7 @@ implicitClassThings cl
= -- Does not include default methods, because those Ids may have
-- their own pragmas, unfoldings etc, not derived from the Class object
-- associated types
- -- No recursive call for the classATs, because they
+ -- No extras_plus (recursive call) for the classATs, because they
-- are only the family decls; they have no implicit things
map ATyCon (classATs cl) ++
-- superclass and operation selectors
@@ -1721,8 +1721,7 @@ implicitTyConThings tc
-- for each data constructor in order,
-- the contructor, worker, and (possibly) wrapper
- [ thing | dc <- tyConDataCons tc
- , thing <- AConLike (RealDataCon dc) : dataConImplicitTyThings dc ]
+ concatMap (extras_plus . AConLike . RealDataCon) (tyConDataCons tc)
-- NB. record selectors are *not* implicit, they have fully-fledged
-- bindings that pass through the compilation pipeline as normal.
where
@@ -1730,6 +1729,10 @@ implicitTyConThings tc
Nothing -> []
Just cl -> implicitClassThings cl
+-- add a thing and recursive call
+extras_plus :: TyThing -> [TyThing]
+extras_plus thing = thing : implicitTyThings thing
+
-- For newtypes and closed type families (only) add the implicit coercion tycon
implicitCoTyCon :: TyCon -> [TyThing]
implicitCoTyCon tc