diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-10-23 10:49:55 +0100 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2021-10-23 10:49:55 +0100 |
commit | 65e5de54803859d5ae71d6f2f6e0d79a0bf7f979 (patch) | |
tree | 5004151ffd969aa238132ce718c0eac6a8ccd5c3 | |
parent | dd2dba808aaa957c3d036b0025b412c499aace3d (diff) | |
download | haskell-65e5de54803859d5ae71d6f2f6e0d79a0bf7f979.tar.gz |
EPA: Use LocatedA for ModuleNamewip/az/locateda-modulename
This allows us to use an Anchor with a DeltaPos in it when exact
printing.
22 files changed, 59 insertions, 58 deletions
diff --git a/compiler/GHC/Driver/Backpack.hs b/compiler/GHC/Driver/Backpack.hs index 8167402525..852ff4c0f2 100644 --- a/compiler/GHC/Driver/Backpack.hs +++ b/compiler/GHC/Driver/Backpack.hs @@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NondecreasingIndentation #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeFamilies #-} -- | This is the driver for the 'ghc --backpack' mode, which @@ -788,7 +789,7 @@ summariseRequirement pn mod_name = do hpm_module = L loc (HsModule { hsmodAnn = noAnn, hsmodLayout = NoLayoutInfo, - hsmodName = Just (L loc mod_name), + hsmodName = Just (L (noAnnSrcSpan loc) mod_name), hsmodExports = Nothing, hsmodImports = [], hsmodDecls = [], @@ -877,7 +878,7 @@ hsModuleToModSummary pn hsc_src modname implicit_prelude imps rn_pkg_qual = renameRawPkgQual (hsc_unit_env hsc_env) - convImport (L _ i) = (rn_pkg_qual (ideclPkgQual i), ideclName i) + convImport (L _ i) = (rn_pkg_qual (ideclPkgQual i), reLoc $ ideclName i) extra_sig_imports <- liftIO $ findExtraSigImports hsc_env hsc_src modname diff --git a/compiler/GHC/Hs.hs b/compiler/GHC/Hs.hs index 0de279e597..fc50346b21 100644 --- a/compiler/GHC/Hs.hs +++ b/compiler/GHC/Hs.hs @@ -73,7 +73,7 @@ data HsModule hsmodLayout :: LayoutInfo, -- ^ Layout info for the module. -- For incomplete modules (e.g. the output of parseHeader), it is NoLayoutInfo. - hsmodName :: Maybe (Located ModuleName), + hsmodName :: Maybe (LocatedA ModuleName), -- ^ @Nothing@: \"module X where\" is omitted (in which case the next -- field is Nothing too) hsmodExports :: Maybe (LocatedL [LIE GhcPs]), diff --git a/compiler/GHC/Hs/ImpExp.hs b/compiler/GHC/Hs/ImpExp.hs index 891415c09f..7282b724cf 100644 --- a/compiler/GHC/Hs/ImpExp.hs +++ b/compiler/GHC/Hs/ImpExp.hs @@ -124,7 +124,7 @@ type instance XCImportDecl GhcTc = NoExtField type instance XXImportDecl (GhcPass _) = NoExtCon -type instance Anno ModuleName = SrcSpan +type instance Anno ModuleName = SrcSpanAnnA type instance Anno [LocatedA (IE (GhcPass p))] = SrcSpanAnnL -- --------------------------------------------------------------------- @@ -146,7 +146,7 @@ simpleImportDecl :: ModuleName -> ImportDecl GhcPs simpleImportDecl mn = ImportDecl { ideclExt = noAnn, ideclSourceSrc = NoSourceText, - ideclName = noLoc mn, + ideclName = noLocA mn, ideclPkgQual = NoRawPkgQual, ideclSource = NotBoot, ideclSafe = False, diff --git a/compiler/GHC/Iface/Ext/Ast.hs b/compiler/GHC/Iface/Ext/Ast.hs index fbeaa8ca3a..e47c90a577 100644 --- a/compiler/GHC/Iface/Ext/Ast.hs +++ b/compiler/GHC/Iface/Ext/Ast.hs @@ -588,8 +588,8 @@ instance (ToHie a) => ToHie (Bag a) where instance (ToHie a) => ToHie (Maybe a) where toHie = maybe (pure []) toHie -instance ToHie (IEContext (Located ModuleName)) where - toHie (IEC c (L (RealSrcSpan span _) mname)) = do +instance ToHie (IEContext (LocatedA ModuleName)) where + toHie (IEC c (L (SrcSpanAnn _ (RealSrcSpan span _)) mname)) = do org <- ask pure $ [Node (mkSourcedNodeInfo org $ NodeInfo S.empty [] idents) span []] where details = mempty{identInfo = S.singleton (IEThing c)} diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index d3781af3b5..6f05f68fb5 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -790,12 +790,12 @@ msubsts :: { OrdList (LHsModuleSubst PackageName) } | msubst { unitOL $1 } msubst :: { LHsModuleSubst PackageName } - : modid '=' moduleid { sLL $1 $> $ ($1, $3) } - | modid VARSYM modid VARSYM { sLL $1 $> $ ($1, sLL $2 $> $ HsModuleVar $3) } + : modid '=' moduleid { sLL (reLoc $1) $> $ (reLoc $1, $3) } + | modid VARSYM modid VARSYM { sLL (reLoc $1) $> $ (reLoc $1, sLL $2 $> $ HsModuleVar (reLoc $3)) } moduleid :: { LHsModuleId PackageName } - : VARSYM modid VARSYM { sLL $1 $> $ HsModuleVar $2 } - | unitid ':' modid { sLL $1 $> $ HsModuleId $1 $3 } + : VARSYM modid VARSYM { sLL $1 $> $ HsModuleVar (reLoc $2) } + | unitid ':' modid { sLL $1 (reLoc $>) $ HsModuleId $1 (reLoc $3) } pkgname :: { Located PackageName } : STRING { sL1 $1 $ PackageName (getSTRING $1) } @@ -832,8 +832,8 @@ rns :: { OrdList LRenaming } | rn { unitOL $1 } rn :: { LRenaming } - : modid 'as' modid { sLL $1 $> $ Renaming $1 (Just $3) } - | modid { sL1 $1 $ Renaming $1 Nothing } + : modid 'as' modid { sLL (reLoc $1) (reLoc $>) $ Renaming (reLoc $1) (Just (reLoc $3)) } + | modid { sL1 (reLoc $1) $ Renaming (reLoc $1) Nothing } unitbody :: { OrdList (LHsUnitDecl PackageName) } : '{' unitdecls '}' { $2 } @@ -851,19 +851,19 @@ unitdecl :: { LHsUnitDecl PackageName } (case snd $2 of NotBoot -> HsSrcFile IsBoot -> HsBootFile) - $3 + (reLoc $3) (Just $ sL1 $1 (HsModule noAnn (thdOf3 $7) (Just $3) $5 (fst $ sndOf3 $7) (snd $ sndOf3 $7) $4 Nothing)) } | 'signature' modid maybemodwarning maybeexports 'where' body { sL1 $1 $ DeclD HsigFile - $2 + (reLoc $2) (Just $ sL1 $1 (HsModule noAnn (thdOf3 $6) (Just $2) $4 (fst $ sndOf3 $6) (snd $ sndOf3 $6) $3 Nothing)) } | 'module' maybe_src modid { sL1 $1 $ DeclD (case snd $2 of NotBoot -> HsSrcFile - IsBoot -> HsBootFile) $3 Nothing } + IsBoot -> HsBootFile) (reLoc $3) Nothing } | 'signature' modid - { sL1 $1 $ DeclD HsigFile $2 Nothing } + { sL1 $1 $ DeclD HsigFile (reLoc $2) Nothing } | 'dependency' unitid mayberns { sL1 $1 $ IncludeD (IncludeDecl { idUnitId = $2 , idModRenaming = $3 @@ -1014,7 +1014,7 @@ exportlist1 :: { OrdList (LIE GhcPs) } export :: { OrdList (LIE GhcPs) } : qcname_ext export_subspec {% mkModuleImpExp (fst $ unLoc $2) $1 (snd $ unLoc $2) >>= \ie -> fmap (unitOL . reLocA) (return (sLL (reLoc $1) $> ie)) } - | 'module' modid {% fmap (unitOL . reLocA) (acs (\cs -> sLL $1 $> (IEModuleContents (EpAnn (glR $1) [mj AnnModule $1] cs) $2))) } + | 'module' modid {% fmap (unitOL . reLocA) (acs (\cs -> sLL $1 (reLoc $>) (IEModuleContents (EpAnn (glR $1) [mj AnnModule $1] cs) $2))) } | 'pattern' qcon { unitOL (reLocA (sLL $1 (reLocN $>) (IEVar noExtField (sLLa $1 (reLocN $>) (IEPattern (glAA $1) $2))))) } @@ -1105,7 +1105,7 @@ importdecl :: { LImportDecl GhcPs } , importDeclAnnPackage = fst $5 , importDeclAnnAs = fst $8 } - ; fmap reLocA $ acs (\cs -> L (comb5 $1 $6 $7 (snd $8) $9) $ + ; fmap reLocA $ acs (\cs -> L (comb5 $1 (reLoc $6) $7 (snd $8) $9) $ ImportDecl { ideclExt = EpAnn (glR $1) anns cs , ideclSourceSrc = snd $ fst $2 , ideclName = $6, ideclPkgQual = snd $5 @@ -1139,9 +1139,9 @@ optqualified :: { Located (Maybe EpaLocation) } : 'qualified' { sL1 $1 (Just (glAA $1)) } | {- empty -} { noLoc Nothing } -maybeas :: { (Maybe EpaLocation,Located (Maybe (Located ModuleName))) } +maybeas :: { (Maybe EpaLocation,Located (Maybe (LocatedA ModuleName))) } : 'as' modid { (Just (glAA $1) - ,sLL $1 $> (Just $2)) } + ,sLL $1 (reLoc $>) (Just $2)) } | {- empty -} { (Nothing,noLoc Nothing) } maybeimpspec :: { Located (Maybe (Bool, LocatedL [LIE GhcPs])) } @@ -3847,9 +3847,9 @@ close :: { () } ----------------------------------------------------------------------------- -- Miscellaneous (mostly renamings) -modid :: { Located ModuleName } - : CONID { sL1 $1 $ mkModuleNameFS (getCONID $1) } - | QCONID { sL1 $1 $ let (mod,c) = getQCONID $1 in +modid :: { LocatedA ModuleName } + : CONID { sL1a $1 $ mkModuleNameFS (getCONID $1) } + | QCONID { sL1a $1 $ let (mod,c) = getQCONID $1 in mkModuleNameFS (mkFastString (unpackFS mod ++ '.':unpackFS c)) diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs index c19c873c91..cb8a5c334e 100644 --- a/compiler/GHC/Parser/Header.hs +++ b/compiler/GHC/Parser/Header.hs @@ -97,7 +97,7 @@ getImports popts implicit_prelude buf filename source_filename = do imps = hsmodImports hsmod main_loc = srcLocSpan (mkSrcLoc (mkFastString source_filename) 1 1) - mod = mb_mod `orElse` L main_loc mAIN_NAME + mod = mb_mod `orElse` L (noAnnSrcSpan main_loc) mAIN_NAME (src_idecls, ord_idecls) = partition ((== IsBoot) . ideclSource . unLoc) imps -- GHC.Prim doesn't exist physically, so don't go looking for it. @@ -108,12 +108,12 @@ getImports popts implicit_prelude buf filename source_filename = do implicit_imports = mkPrelImports (unLoc mod) main_loc implicit_prelude imps - convImport (L _ i) = (ideclPkgQual i, ideclName i) + convImport (L _ i) = (ideclPkgQual i, reLoc $ ideclName i) in return (map convImport src_idecls , map convImport (implicit_imports ++ ordinary_imps) , not (null ghc_prim_import) - , mod) + , reLoc mod) mkPrelImports :: ModuleName -> SrcSpan -- Attribute the "import Prelude" to this location @@ -146,7 +146,7 @@ mkPrelImports this_mod loc implicit_prelude import_decls preludeImportDecl = L loc' $ ImportDecl { ideclExt = noAnn, ideclSourceSrc = NoSourceText, - ideclName = L loc pRELUDE_NAME, + ideclName = L loc' pRELUDE_NAME, ideclPkgQual = NoRawPkgQual, ideclSource = NotBoot, ideclSafe = False, -- Not a safe import diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 5cb81edcdb..f0adba4e6f 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -249,10 +249,10 @@ instance HasHaddock (Located HsModule) where -- Only do this when the module header exists. headerDocs <- for @Maybe (hsmodName mod) $ \(L l_name _) -> - extendHdkA l_name $ liftHdkA $ do + extendHdkA (locA l_name) $ liftHdkA $ do -- todo: register keyword location of 'module', see Note [Register keyword location] docs <- - inLocRange (locRangeTo (getBufPos (srcSpanStart l_name))) $ + inLocRange (locRangeTo (getBufPos (srcSpanStart (locA l_name)))) $ takeHdkComments mkDocNext selectDocString docs diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs index f4fa104f1e..67350973b5 100644 --- a/compiler/GHC/Rename/Names.hs +++ b/compiler/GHC/Rename/Names.hs @@ -606,7 +606,7 @@ warnUnqualifiedImport decl iface = addDiagnosticAt loc msg where mod = mi_module iface - loc = getLoc $ ideclName decl + loc = getLocA $ ideclName decl is_qual = isImportDeclQualified (ideclQualified decl) has_import_list = diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs index 2c425e6eda..cb71508227 100644 --- a/compiler/GHC/Tc/Module.hs +++ b/compiler/GHC/Tc/Module.hs @@ -223,7 +223,7 @@ tcRnModule hsc_env mod_sum save_rn_syntax pair :: (Module, SrcSpan) pair@(this_mod,_) | Just (L mod_loc mod) <- hsmodName this_module - = (mkHomeModule home_unit mod, mod_loc) + = (mkHomeModule home_unit mod, locA mod_loc) | otherwise -- 'module M where' is omitted = (mkHomeModule home_unit mAIN_NAME, srcLocSpan (srcSpanStart loc)) @@ -271,7 +271,7 @@ tcRnModuleTcRnM hsc_env mod_sum ; -- TODO This is a little skeevy; maybe handle a bit more directly let { simplifyImport (L _ idecl) = ( renameRawPkgQual (hsc_unit_env hsc_env) (ideclPkgQual idecl) - , ideclName idecl) + , reLoc $ ideclName idecl) } ; raw_sig_imports <- liftIO $ findExtraSigImports hsc_env hsc_src diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr index 0fcb9122ed..566d319538 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr @@ -30,7 +30,7 @@ (1)) (Just (L - { T17544.hs:3:8-13 } + (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:3:8-13 }) {ModuleName: T17544})) (Nothing) [] diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr index d294430cd4..41346ee437 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr @@ -30,7 +30,7 @@ (1)) (Just (L - { T17544_kw.hs:13:3-11 } + (SrcSpanAnn (EpAnnNotUsed) { T17544_kw.hs:13:3-11 }) {ModuleName: T17544_kw})) (Nothing) [] diff --git a/testsuite/tests/module/mod185.stderr b/testsuite/tests/module/mod185.stderr index 1463324978..663f963e99 100644 --- a/testsuite/tests/module/mod185.stderr +++ b/testsuite/tests/module/mod185.stderr @@ -48,7 +48,7 @@ [])) (NoSourceText) (L - { mod185.hs:3:8-14 } + (SrcSpanAnn (EpAnnNotUsed) { mod185.hs:3:8-14 }) {ModuleName: Prelude}) (NoRawPkgQual) (NotBoot) diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr index 31c2d79256..72609565a8 100644 --- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr @@ -30,7 +30,7 @@ (1)) (Just (L - { DumpParsedAst.hs:5:8-20 } + (SrcSpanAnn (EpAnnNotUsed) { DumpParsedAst.hs:5:8-20 }) {ModuleName: DumpParsedAst})) (Nothing) [(L @@ -51,7 +51,7 @@ [])) (NoSourceText) (L - { DumpParsedAst.hs:6:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { DumpParsedAst.hs:6:8-16 }) {ModuleName: Data.Kind}) (NoRawPkgQual) (NotBoot) diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr index d8beda8fa4..b7ef9c2ce6 100644 --- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr @@ -1261,7 +1261,7 @@ (NoExtField) (NoSourceText) (L - { DumpRenamedAst.hs:5:8-21 } + (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:5:8-21 }) {ModuleName: Prelude}) (NoPkgQual) (NotBoot) @@ -1276,7 +1276,7 @@ (NoExtField) (NoSourceText) (L - { DumpRenamedAst.hs:6:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:6:8-16 }) {ModuleName: Data.Kind}) (NoPkgQual) (NotBoot) @@ -1291,7 +1291,7 @@ (NoExtField) (NoSourceText) (L - { DumpRenamedAst.hs:8:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:8:8-16 }) {ModuleName: Data.Kind}) (NoPkgQual) (NotBoot) diff --git a/testsuite/tests/parser/should_compile/DumpSemis.stderr b/testsuite/tests/parser/should_compile/DumpSemis.stderr index 0f5b6f869d..1b59817f4d 100644 --- a/testsuite/tests/parser/should_compile/DumpSemis.stderr +++ b/testsuite/tests/parser/should_compile/DumpSemis.stderr @@ -41,7 +41,7 @@ (1)) (Just (L - { DumpSemis.hs:1:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:1:8-16 }) {ModuleName: DumpSemis})) (Nothing) [(L @@ -74,7 +74,7 @@ [])) (NoSourceText) (L - { DumpSemis.hs:5:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:5:8-16 }) {ModuleName: Data.List}) (NoRawPkgQual) (NotBoot) @@ -113,7 +113,7 @@ [])) (NoSourceText) (L - { DumpSemis.hs:7:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:7:8-16 }) {ModuleName: Data.Kind}) (NoRawPkgQual) (NotBoot) diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr index bd9c0deaf0..3bd3964024 100644 --- a/testsuite/tests/parser/should_compile/KindSigs.stderr +++ b/testsuite/tests/parser/should_compile/KindSigs.stderr @@ -30,7 +30,7 @@ (1)) (Just (L - { KindSigs.hs:6:8-15 } + (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:6:8-15 }) {ModuleName: KindSigs})) (Nothing) [(L @@ -51,7 +51,7 @@ [])) (NoSourceText) (L - { KindSigs.hs:8:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:8:8-16 }) {ModuleName: Data.Kind}) (NoRawPkgQual) (NotBoot) diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr index eeadfcc06d..6accce1c99 100644 --- a/testsuite/tests/parser/should_compile/T14189.stderr +++ b/testsuite/tests/parser/should_compile/T14189.stderr @@ -168,7 +168,7 @@ (NoExtField) (NoSourceText) (L - { T14189.hs:1:8-13 } + (SrcSpanAnn (EpAnnNotUsed) { T14189.hs:1:8-13 }) {ModuleName: Prelude}) (NoPkgQual) (NotBoot) diff --git a/testsuite/tests/parser/should_compile/T15323.stderr b/testsuite/tests/parser/should_compile/T15323.stderr index 20867efede..0a2f60dd59 100644 --- a/testsuite/tests/parser/should_compile/T15323.stderr +++ b/testsuite/tests/parser/should_compile/T15323.stderr @@ -30,7 +30,7 @@ (1)) (Just (L - { T15323.hs:3:8-13 } + (SrcSpanAnn (EpAnnNotUsed) { T15323.hs:3:8-13 }) {ModuleName: T15323})) (Nothing) [] diff --git a/testsuite/tests/parser/should_compile/T20452.stderr b/testsuite/tests/parser/should_compile/T20452.stderr index d1a11145fa..c5eded00e9 100644 --- a/testsuite/tests/parser/should_compile/T20452.stderr +++ b/testsuite/tests/parser/should_compile/T20452.stderr @@ -30,7 +30,7 @@ (1)) (Just (L - { T20452.hs:3:8-13 } + (SrcSpanAnn (EpAnnNotUsed) { T20452.hs:3:8-13 }) {ModuleName: T20452})) (Nothing) [] diff --git a/testsuite/tests/printer/T18791.stderr b/testsuite/tests/printer/T18791.stderr index 90b3db958d..65fe422f4a 100644 --- a/testsuite/tests/printer/T18791.stderr +++ b/testsuite/tests/printer/T18791.stderr @@ -30,7 +30,7 @@ (1)) (Just (L - { T18791.hs:2:8-13 } + (SrcSpanAnn (EpAnnNotUsed) { T18791.hs:2:8-13 }) {ModuleName: T18791})) (Nothing) [] diff --git a/testsuite/tests/printer/Test20297.stdout b/testsuite/tests/printer/Test20297.stdout index 6340f6b183..615f265e76 100644 --- a/testsuite/tests/printer/Test20297.stdout +++ b/testsuite/tests/printer/Test20297.stdout @@ -37,7 +37,7 @@ (1)) (Just (L - { Test20297.hs:2:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { Test20297.hs:2:8-16 }) {ModuleName: Test20297})) (Nothing) [] @@ -383,7 +383,7 @@ (1)) (Just (L - { Test20297.ppr.hs:2:8-16 } + (SrcSpanAnn (EpAnnNotUsed) { Test20297.ppr.hs:2:8-16 }) {ModuleName: Test20297})) (Nothing) [] diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index 488fad1ca4..7025a0d094 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -742,7 +742,7 @@ instance ExactPrint (LocatedP WarningTxt) where instance ExactPrint (ImportDecl GhcPs) where getAnnotationEntry idecl = fromAnn (ideclExt idecl) exact x@(ImportDecl EpAnnNotUsed _ _ _ _ _ _ _ _ _) = withPpr x - exact (ImportDecl ann@(EpAnn _ an _) msrc (L lm modname) mpkg _src safeflag qualFlag _impl mAs hiding) = do + exact (ImportDecl ann@(EpAnn _ an _) msrc modname mpkg _src safeflag qualFlag _impl mAs hiding) = do markAnnKw ann importDeclAnnImport AnnImport @@ -765,7 +765,7 @@ instance ExactPrint (ImportDecl GhcPs) where printStringAtMkw (importDeclAnnPackage an) (sourceTextToString src (show v)) _ -> return () - printStringAtKw' (realSrcSpan lm) (moduleNameString modname) + markAnnotated modname case qualFlag of QualifiedPost -- 'qualified' appears in postpositive position. @@ -774,9 +774,9 @@ instance ExactPrint (ImportDecl GhcPs) where case mAs of Nothing -> return () - Just (L l mn) -> do + Just mn -> do printStringAtMkw (importDeclAnnAs an) "as" - printStringAtKw' (realSrcSpan l) (moduleNameString mn) + markAnnotated mn case hiding of Nothing -> return () @@ -3488,9 +3488,9 @@ instance ExactPrint (IE GhcPs) where markAnnotated as markEpAnn an AnnCloseP - exact (IEModuleContents an (L lm mn)) = do + exact (IEModuleContents an mn) = do markEpAnn an AnnModule - printStringAtSs lm (moduleNameString mn) + markAnnotated mn -- exact (IEGroup _ _ _) = NoEntryVal -- exact (IEDoc _ _) = NoEntryVal |