[Git][ghc/ghc][wip/az/epa-importdecl-span] EPA: Provide correct annotation span for ImportDecl
Alan Zimmerman (@alanz)
gitlab at gitlab.haskell.org
Sat Jul 29 19:56:58 UTC 2023
Alan Zimmerman pushed to branch wip/az/epa-importdecl-span at Glasgow Haskell Compiler / GHC
Commits:
70790dd4 by Alan Zimmerman at 2023-07-29T20:55:38+01:00
EPA: Provide correct annotation span for ImportDecl
Use the whole declaration, rather than just the span of the 'import'
keyword.
Metric Decrease:
T9961
Metric Increase:
T13035
- - - - -
6 changed files:
- compiler/GHC/Parser.y
- testsuite/tests/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
Changes:
=====================================
compiler/GHC/Parser.y
=====================================
@@ -1134,8 +1134,9 @@ importdecl :: { LImportDecl GhcPs }
, importDeclAnnPackage = fst $5
, importDeclAnnAs = fst $8
}
- ; fmap reLocA $ acs (\cs -> L (comb5 $1 $6 $7 (snd $8) $9) $
- ImportDecl { ideclExt = XImportDeclPass (EpAnn (glR $1) anns cs) (snd $ fst $2) False
+ ; let loc = (comb5 $1 $6 $7 (snd $8) $9);
+ ; fmap reLocA $ acs (\cs -> L loc $
+ ImportDecl { ideclExt = XImportDeclPass (EpAnn (spanAsAnchor loc) anns cs) (snd $ fst $2) False
, ideclName = $6, ideclPkgQual = snd $5
, ideclSource = snd $2, ideclSafe = snd $3
, ideclQualified = snd $ importDeclQualifiedStyle mPreQual mPostQual
=====================================
testsuite/tests/module/mod185.stderr
=====================================
@@ -31,7 +31,7 @@
(XImportDeclPass
(EpAnn
(Anchor
- { mod185.hs:3:1-6 }
+ { mod185.hs:3:1-24 }
(UnchangedAnchor))
(EpAnnImportDecl
(EpaSpan { mod185.hs:3:1-6 })
=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -35,7 +35,7 @@
(XImportDeclPass
(EpAnn
(Anchor
- { DumpParsedAst.hs:5:1-6 }
+ { DumpParsedAst.hs:5:1-16 }
(UnchangedAnchor))
(EpAnnImportDecl
(EpaSpan { DumpParsedAst.hs:5:1-6 })
=====================================
testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
=====================================
@@ -1466,7 +1466,7 @@
(XImportDeclPass
(EpAnn
(Anchor
- { DumpRenamedAst.hs:5:1-6 }
+ { DumpRenamedAst.hs:5:1-16 }
(UnchangedAnchor))
(EpAnnImportDecl
(EpaSpan { DumpRenamedAst.hs:5:1-6 })
@@ -1494,7 +1494,7 @@
(XImportDeclPass
(EpAnn
(Anchor
- { DumpRenamedAst.hs:7:1-6 }
+ { DumpRenamedAst.hs:7:1-23 }
(UnchangedAnchor))
(EpAnnImportDecl
(EpaSpan { DumpRenamedAst.hs:7:1-6 })
=====================================
testsuite/tests/parser/should_compile/DumpSemis.stderr
=====================================
@@ -58,7 +58,7 @@
(XImportDeclPass
(EpAnn
(Anchor
- { DumpSemis.hs:5:1-6 }
+ { DumpSemis.hs:5:1-19 }
(UnchangedAnchor))
(EpAnnImportDecl
(EpaSpan { DumpSemis.hs:5:1-6 })
@@ -116,7 +116,7 @@
(XImportDeclPass
(EpAnn
(Anchor
- { DumpSemis.hs:7:1-6 }
+ { DumpSemis.hs:7:1-16 }
(UnchangedAnchor))
(EpAnnImportDecl
(EpaSpan { DumpSemis.hs:7:1-6 })
=====================================
testsuite/tests/parser/should_compile/KindSigs.stderr
=====================================
@@ -35,7 +35,7 @@
(XImportDeclPass
(EpAnn
(Anchor
- { KindSigs.hs:8:1-6 }
+ { KindSigs.hs:8:1-16 }
(UnchangedAnchor))
(EpAnnImportDecl
(EpaSpan { KindSigs.hs:8:1-6 })
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70790dd40f307ecaec2c063c655e720978b6f907
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70790dd40f307ecaec2c063c655e720978b6f907
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230729/4ffd64e7/attachment-0001.html>
More information about the ghc-commits
mailing list