summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen/Export.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc/Gen/Export.hs')
-rw-r--r--compiler/GHC/Tc/Gen/Export.hs29
1 files changed, 15 insertions, 14 deletions
diff --git a/compiler/GHC/Tc/Gen/Export.hs b/compiler/GHC/Tc/Gen/Export.hs
index ec0efc48d5..168127bd19 100644
--- a/compiler/GHC/Tc/Gen/Export.hs
+++ b/compiler/GHC/Tc/Gen/Export.hs
@@ -154,7 +154,7 @@ type ExportOccMap = OccEnv (GreName, IE GhcPs)
-- that have the same occurrence name
rnExports :: Bool -- False => no 'module M(..) where' header at all
- -> Maybe (Located [LIE GhcPs]) -- Nothing => no explicit export list
+ -> Maybe (LocatedL [LIE GhcPs]) -- Nothing => no explicit export list
-> RnM TcGblEnv
-- Complains if two distinct exports have same OccName
@@ -188,10 +188,11 @@ rnExports explicit_mod exports
-- See Note [Modules without a module header]
; let real_exports
| explicit_mod = exports
- | has_main = Just (noLoc [noLoc (IEVar noExtField
- (noLoc (IEName $ noLoc default_main)))])
- -- ToDo: the 'noLoc' here is unhelpful if 'main'
- -- turns out to be out of scope
+ | has_main
+ = Just (noLocA [noLocA (IEVar noExtField
+ (noLocA (IEName $ noLocA default_main)))])
+ -- ToDo: the 'noLoc' here is unhelpful if 'main'
+ -- turns out to be out of scope
| otherwise = Nothing
-- Rename the export list
@@ -216,7 +217,7 @@ rnExports explicit_mod exports
, tcg_dus = tcg_dus tcg_env `plusDU`
usesOnly final_ns }) }
-exports_from_avail :: Maybe (Located [LIE GhcPs])
+exports_from_avail :: Maybe (LocatedL [LIE GhcPs])
-- ^ 'Nothing' means no explicit export list
-> GlobalRdrEnv
-> ImportAvails
@@ -262,7 +263,7 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod
where
do_litem :: ExportAccum -> LIE GhcPs
-> RnM (Maybe (ExportAccum, (LIE GhcRn, Avails)))
- do_litem acc lie = setSrcSpan (getLoc lie) (exports_from_item acc lie)
+ do_litem acc lie = setSrcSpan (getLocA lie) (exports_from_item acc lie)
-- Maps a parent to its in-scope children
kids_env :: NameEnv [GlobalRdrElt]
@@ -344,14 +345,14 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod
lookup_ie (IEThingAbs _ (L l rdr))
= do (name, avail) <- lookupGreAvailRn $ ieWrappedName rdr
- return (IEThingAbs noExtField (L l (replaceWrappedName rdr name))
+ return (IEThingAbs noAnn (L l (replaceWrappedName rdr name))
, avail)
lookup_ie ie@(IEThingAll _ n')
= do
(n, avail, flds) <- lookup_ie_all ie n'
let name = unLoc n
- return (IEThingAll noExtField (replaceLWrappedName n' (unLoc n))
+ return (IEThingAll noAnn (replaceLWrappedName n' (unLoc n))
, availTC name (name:avail) flds)
@@ -380,8 +381,8 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod
= do name <- lookupGlobalOccRn $ ieWrappedName rdr
(non_flds, flds) <- lookupChildrenExport name sub_rdrs
if isUnboundName name
- then return (L l name, [], [name], [])
- else return (L l name, non_flds
+ then return (L (locA l) name, [], [name], [])
+ else return (L (locA l) name, non_flds
, map (ieWrappedName . unLoc) non_flds
, flds)
@@ -401,7 +402,7 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod
else -- This occurs when you export T(..), but
-- only import T abstractly, or T is a synonym.
addErr (exportItemErr ie)
- return (L l name, non_flds, flds)
+ return (L (locA l) name, non_flds, flds)
-------------
lookup_doc_ie :: IE GhcPs -> Maybe (IE GhcRn)
@@ -517,10 +518,10 @@ lookupChildrenExport spec_parent rdr_items =
case name of
NameNotFound -> do { ub <- reportUnboundName unboundName
; let l = getLoc n
- ; return (Left (L l (IEName (L l ub))))}
+ ; return (Left (L l (IEName (L (la2na l) ub))))}
FoundChild par child -> do { checkPatSynParent spec_parent par child
; return $ case child of
- FieldGreName fl -> Right (L (getLoc n) fl)
+ FieldGreName fl -> Right (L (getLocA n) fl)
NormalGreName name -> Left (replaceLWrappedName n name)
}
IncorrectParent p c gs -> failWithDcErr p c gs