Commit c6bb2fc5 authored by Matthew Pickering's avatar Matthew Pickering Committed by Alan Zimmerman
Browse files

Correct BangPat SrcSpan calculation

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:

GHC Trac Issues: #10588
parent 9b5df2a4
......@@ -997,9 +997,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)
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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment