diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2020-08-07 18:52:47 +0100 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2020-08-09 11:09:32 +0100 |
commit | 701463ec9998c679b03dcc848912a7ce9da9a66a (patch) | |
tree | f3596fda5c861addcff3032f81154da42cf732d9 | |
parent | 8a665db6174eaedbbae925c0ccb4c22b3f29bcaf (diff) | |
download | haskell-wip/az/anns-2.tar.gz |
Api Annotations : Adjust SrcSpans for prefix bang (!).wip/az/anns-2
And prefix ~
(cherry picked from commit 8dbee2c578b1f642d45561be3f416119863e01eb)
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/annotations/Makefile | 3 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/annotations/T10358.stdout | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index b061161a56..55e464fad1 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/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 = [] diff --git a/testsuite/tests/ghc-api/annotations/Makefile b/testsuite/tests/ghc-api/annotations/Makefile index 5f0fea1cc7..a9bd5b36da 100644 --- a/testsuite/tests/ghc-api/annotations/Makefile +++ b/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: diff --git a/testsuite/tests/ghc-api/annotations/T10358.stdout b/testsuite/tests/ghc-api/annotations/T10358.stdout index 2216c8396e..fca1a5baa6 100644 --- a/testsuite/tests/ghc-api/annotations/T10358.stdout +++ b/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)--- [ |