[Git][ghc/ghc][wip/az/anns-2] Api Annotations : Adjust SrcSpans for prefix bang (!).
Alan Zimmerman
gitlab at gitlab.haskell.org
Sun Aug 9 10:14:11 UTC 2020
Alan Zimmerman pushed to branch wip/az/anns-2 at Glasgow Haskell Compiler / GHC
Commits:
701463ec by Alan Zimmerman at 2020-08-09T11:09:32+01:00
Api Annotations : Adjust SrcSpans for prefix bang (!).
And prefix ~
(cherry picked from commit 8dbee2c578b1f642d45561be3f416119863e01eb)
- - - - -
3 changed files:
- compiler/GHC/Parser/PostProcess.hs
- testsuite/tests/ghc-api/annotations/Makefile
- testsuite/tests/ghc-api/annotations/T10358.stdout
Changes:
=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -1201,13 +1201,14 @@ makeFunBind fn ms
checkPatBind :: LPat GhcPs
-> Located (a,GRHSs GhcPs (LHsExpr GhcPs))
-> P ([AddAnn],HsBind GhcPs)
-checkPatBind lhs (L match_span (_,grhss))
+checkPatBind lhs (L rhs_span (_,grhss))
| BangPat _ p <- unLoc lhs
, VarPat _ v <- unLoc p
= return ([], makeFunBind v [L match_span (m v)])
where
+ match_span = combineSrcSpans (getLoc lhs) rhs_span
m v = Match { m_ext = noExtField
- , m_ctxt = FunRhs { mc_fun = L (getLoc lhs) (unLoc v)
+ , m_ctxt = FunRhs { mc_fun = v
, mc_fixity = Prefix
, mc_strictness = SrcStrict }
, m_pats = []
=====================================
testsuite/tests/ghc-api/annotations/Makefile
=====================================
@@ -39,7 +39,8 @@ listcomps:
.PHONY: T10358
T10358:
- $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test10358.hs
+ # Ignore result code, we have an unattached (superfluous) AnnBang
+ - $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test10358.hs
.PHONY: T10396
T10396:
=====================================
testsuite/tests/ghc-api/annotations/T10358.stdout
=====================================
@@ -1,5 +1,5 @@
---Unattached Annotation Problems (should be empty list)---
-[]
+[(AnnBang, Test10358.hs:5:19)]
---Ann before enclosing span problem (should be empty list)---
[
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/701463ec9998c679b03dcc848912a7ce9da9a66a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/701463ec9998c679b03dcc848912a7ce9da9a66a
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/20200809/8e20fb61/attachment-0001.html>
More information about the ghc-commits
mailing list