summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Module.hs
diff options
context:
space:
mode:
authorromes <rodrigo.m.mesquita@gmail.com>2022-05-17 16:06:52 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-03 14:11:31 -0400
commitf9f8099598fd169fa2f17305fc660e5c473f8836 (patch)
tree5acdb9a38b78dc17ffa0abb63d87555e214d98af /compiler/GHC/Tc/Module.hs
parent3a8970ac0c69335a1d229f9c9a71e6e333e99bfb (diff)
downloadhaskell-f9f8099598fd169fa2f17305fc660e5c473f8836.tar.gz
TTG: Move ImpExp client-independent bits to L.H.S.ImpExp
Move the GHC-independent definitions from GHC.Hs.ImpExp to Language.Haskell.Syntax.ImpExp with the required TTG extension fields such as to keep the AST independent from GHC. This is progress towards having the haskell-syntax package, as described in #21592 Bumps haddock submodule
Diffstat (limited to 'compiler/GHC/Tc/Module.hs')
-rw-r--r--compiler/GHC/Tc/Module.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index d23fad536c..a332d61fb1 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -239,9 +239,6 @@ tcRnModuleTcRnM :: HscEnv
-> TcRn TcGblEnv
-- Factored out separately from tcRnModule so that a Core plugin can
-- call the type checker directly
-tcRnModuleTcRnM _ _
- (HsParsedModule (L _ (XModule x)) _)
- _ = dataConCantHappen x
tcRnModuleTcRnM hsc_env mod_sum
(HsParsedModule {
hpm_module =
@@ -285,7 +282,7 @@ tcRnModuleTcRnM hsc_env mod_sum
++ import_decls))
; let { mkImport mod_name = noLocA
$ (simpleImportDecl mod_name)
- { ideclHiding = Just (False, noLocA [])}}
+ { ideclImportList = Just (Exactly, noLocA [])}}
; let { withReason t imps = map (,text t) imps }
; let { all_imports = withReason "is implicitly imported" prel_imports
++ withReason "is directly imported" import_decls
@@ -1652,7 +1649,7 @@ tcPreludeClashWarn warnFlag name = do
-- Implicit (Prelude) import?
isImplicit :: ImportDecl GhcRn -> Bool
- isImplicit = ideclImplicit
+ isImplicit = ideclImplicit . ideclExt
-- Unqualified import?
isUnqualified :: ImportDecl GhcRn -> Bool
@@ -1662,17 +1659,17 @@ tcPreludeClashWarn warnFlag name = do
-- Nothing -> No explicit imports
-- Just (False, <names>) -> Explicit import list of <names>
-- Just (True , <names>) -> Explicit hiding of <names>
- importListOf :: ImportDecl GhcRn -> Maybe (Bool, [Name])
- importListOf = fmap toImportList . ideclHiding
+ importListOf :: ImportDecl GhcRn -> Maybe (ImportListInterpretation, [Name])
+ importListOf = fmap toImportList . ideclImportList
where
toImportList (h, loc) = (h, map (ieName . unLoc) (unLoc loc))
isExplicit :: ImportDecl GhcRn -> Bool
isExplicit x = case importListOf x of
Nothing -> False
- Just (False, explicit)
+ Just (Exactly, explicit)
-> nameOccName name `elem` map nameOccName explicit
- Just (True, hidden)
+ Just (EverythingBut, hidden)
-> nameOccName name `notElem` map nameOccName hidden
-- Check whether the given name would be imported (unqualified) from