diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-05-12 12:56:30 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-05-12 12:56:30 -0400 |
commit | 78db41eaa806206001b80b3d225cd254435a2f83 (patch) | |
tree | 75fd26d6c766c977fbfcd92feb3ec215ba1f9b8f /compiler | |
parent | bec2e71e9869815c058dda9ebb6eb483352aa480 (diff) | |
download | haskell-78db41eaa806206001b80b3d225cd254435a2f83.tar.gz |
Use correct source spans for EmptyCase
Summary:
The parser's calculation of source spans for `EmptyCase`
expressions was a bit off, leading to some wonky-looking error
messages. Easily fixed with some uses of `comb3` and `sLL`.
Test Plan: make test TEST=T15139
Reviewers: bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, thomie, mpickering, carter
GHC Trac Issues: #15139
Differential Revision: https://phabricator.haskell.org/D4685
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/parser/Parser.y | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index a7c875e39e..4c66fd76d6 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -2573,7 +2573,8 @@ aexp :: { LHsExpr GhcPs } ams (sLL $1 $> $ HsMultiIf noExt (reverse $ snd $ unLoc $2)) (mj AnnIf $1:(fst $ unLoc $2)) } - | 'case' exp 'of' altslist {% ams (sLL $1 $> $ HsCase noExt $2 (mkMatchGroup + | 'case' exp 'of' altslist {% ams (L (comb3 $1 $3 $4) $ + HsCase noExt $2 (mkMatchGroup FromSource (snd $ unLoc $4))) (mj AnnCase $1:mj AnnOf $3 :(fst $ unLoc $4)) } @@ -2874,7 +2875,7 @@ altslist :: { Located ([AddAnn],[LMatch GhcPs (LHsExpr GhcPs)]) } ,(reverse (snd $ unLoc $2))) } | vocurly alts close { L (getLoc $2) (fst $ unLoc $2 ,(reverse (snd $ unLoc $2))) } - | '{' '}' { noLoc ([moc $1,mcc $2],[]) } + | '{' '}' { sLL $1 $> ([moc $1,mcc $2],[]) } | vocurly close { noLoc ([],[]) } alts :: { Located ([AddAnn],[LMatch GhcPs (LHsExpr GhcPs)]) } |