summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2015-06-29 21:11:17 +0200
committerAustin Seipp <austin@well-typed.com>2015-06-30 07:50:53 -0500
commit5560861e4562a2e270e6610e6ef3cf120253bb16 (patch)
tree0b5ce746aa27e9a89942727bebc545bf903d68f9
parent9ea4ded2ee7822aed05275c390c285f0a60a6ef6 (diff)
downloadhaskell-ghc-7.10.2-rc2.tar.gz
Correct BangPat SrcSpan calculationghc-7.10.2-rc2
Summary: Previously when the split was performed in splitBang, `BangPat` was given the same SrcSpan as the whole of the LHS of the declaration. This patch correctly calculates the value. Reviewers: alanz, austin Reviewed By: alanz, austin Subscribers: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D1020 GHC Trac Issues: #10588 (cherry picked from commit c6bb2fc50716a2fc540d55ecddbc5c14e94979f7)
-rw-r--r--compiler/parser/RdrHsSyn.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs
index cc019d14bf..3d3e9c972b 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -1169,9 +1169,10 @@ checkDoAndIfThenElse guardExpr semiThen thenExpr semiElse elseExpr
-- not be any OpApps inside the e's
splitBang :: LHsExpr RdrName -> Maybe (LHsExpr RdrName, [LHsExpr RdrName])
-- Splits (f ! g a b) into (f, [(! g), a, b])
-splitBang (L loc (OpApp l_arg bang@(L _ (HsVar op)) _ r_arg))
- | op == bang_RDR = Just (l_arg, L loc (SectionR bang arg1) : argns)
+splitBang (L _ (OpApp l_arg bang@(L _ (HsVar op)) _ r_arg))
+ | op == bang_RDR = Just (l_arg, L l' (SectionR bang arg1) : argns)
where
+ l' = combineLocs bang arg1
(arg1,argns) = split_bang r_arg []
split_bang (L _ (HsApp f e)) es = split_bang f (e:es)
split_bang e es = (e,es)