From 9eab6feed44ad8beb6703d2e27ce47a8f79d0f49 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Tue, 14 Apr 2015 01:17:48 -0500 Subject: parser: API Annotations : guardquals1 does not annotate commas properly The `guardquals1` production includes : guardquals1 ',' qual {% addAnnotation (gl $ last $ unLoc $1) AnnComma (gl $2) >> return (sLL $1 $> ($3 : unLoc $1)) } The AnnComma should be attached to `(gl $ head $ unLoc $1)`, rather than `last`. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D818 GHC Trac Issues: #10256 --- compiler/parser/Parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/parser') diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 8d0b2e2f0c..3a879ba2f6 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -2534,7 +2534,7 @@ guardquals :: { Located [LStmt RdrName (LHsExpr RdrName)] } : guardquals1 { L (getLoc $1) (reverse (unLoc $1)) } guardquals1 :: { Located [LStmt RdrName (LHsExpr RdrName)] } - : guardquals1 ',' qual {% addAnnotation (gl $ last $ unLoc $1) AnnComma + : guardquals1 ',' qual {% addAnnotation (gl $ head $ unLoc $1) AnnComma (gl $2) >> return (sLL $1 $> ($3 : unLoc $1)) } | qual { sL1 $1 [$1] } -- cgit v1.2.1