From f9f8099598fd169fa2f17305fc660e5c473f8836 Mon Sep 17 00:00:00 2001 From: romes Date: Tue, 17 May 2022 16:06:52 +0200 Subject: 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 --- compiler/GHC/Parser/Header.hs | 10 ++++++---- compiler/GHC/Parser/PostProcess.hs | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'compiler/GHC/Parser') diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs index 2a31d21cfc..9daf8e5d71 100644 --- a/compiler/GHC/Parser/Header.hs +++ b/compiler/GHC/Parser/Header.hs @@ -145,16 +145,18 @@ mkPrelImports this_mod loc implicit_prelude import_decls loc' = noAnnSrcSpan loc preludeImportDecl :: LImportDecl GhcPs preludeImportDecl - = L loc' $ ImportDecl { ideclExt = noAnn, - ideclSourceSrc = NoSourceText, + = L loc' $ ImportDecl { ideclExt = XImportDeclPass + { ideclAnn = noAnn + , ideclSourceText = NoSourceText + , ideclImplicit = True -- Implicit! + }, ideclName = L loc' pRELUDE_NAME, ideclPkgQual = NoRawPkgQual, ideclSource = NotBoot, ideclSafe = False, -- Not a safe import ideclQualified = NotQualified, - ideclImplicit = True, -- Implicit! ideclAs = Nothing, - ideclHiding = Nothing } + ideclImportList = Nothing } -------------------------------------------------------------- -- Get options diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index e67e6d734e..9dabe3331d 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -2787,7 +2787,7 @@ mkModuleImpExp anns (L l specname) subs = do let withs = map unLoc xs pos = maybe NoIEWildcard IEWildcard (findIndex isImpExpQcWildcard withs) - ies :: [LocatedA (IEWrappedName RdrName)] + ies :: [LocatedA (IEWrappedName GhcPs)] ies = wrapped $ filter (not . isImpExpQcWildcard . unLoc) xs in (\newName -> IEThingWith ann (L l newName) pos ies) @@ -2806,8 +2806,9 @@ mkModuleImpExp anns (L l specname) subs = do ieNameVal (ImpExpQcType _ ln) = unLoc ln ieNameVal (ImpExpQcWildcard) = panic "ieNameVal got wildcard" - ieNameFromSpec (ImpExpQcName ln) = IEName ln - ieNameFromSpec (ImpExpQcType r ln) = IEType r ln + ieNameFromSpec :: ImpExpQcSpec -> IEWrappedName GhcPs + ieNameFromSpec (ImpExpQcName (L l n)) = IEName noExtField (L l n) + ieNameFromSpec (ImpExpQcType r (L l n)) = IEType r (L l n) ieNameFromSpec (ImpExpQcWildcard) = panic "ieName got wildcard" wrapped = map (mapLoc ieNameFromSpec) -- cgit v1.2.1