[commit: ghc] ghc-7.10: GRHS with empty wherebinds gets wrong SrcSpan (9956c18)

git at git.haskell.org git at git.haskell.org
Thu Feb 5 23:46:40 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/9956c18bff581b56411db81c8cc1447732659c50/ghc

>---------------------------------------------------------------

commit 9956c18bff581b56411db81c8cc1447732659c50
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Thu Feb 5 17:37:42 2015 -0600

    GRHS with empty wherebinds gets wrong SrcSpan
    
    Summary:
    When parsing a rhs, the GRHS is constructed via unguardedRHS which is
    given a SrcSpan which only takes account of the '=' and wherebinds, so
    does not include the exp when wherebinds are empty.
    
    Test Plan: ./validate
    
    Reviewers: hvr, austin
    
    Reviewed By: austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D643
    
    (cherry picked from commit d4f25cb151db1a539aab66b26ccca4d166562b22)


>---------------------------------------------------------------

9956c18bff581b56411db81c8cc1447732659c50
 compiler/parser/Parser.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index e376090..1bffbee 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1875,7 +1875,7 @@ decl    :: { Located (OrdList (LHsDecl RdrName)) }
 rhs     :: { Located ([AddAnn],GRHSs RdrName (LHsExpr RdrName)) }
         : '=' exp wherebinds    { sL (comb3 $1 $2 $3)
                                     ((mj AnnEqual $1 : (fst $ unLoc $3))
-                                    ,GRHSs (unguardedRHS (comb2 $1 $3) $2)
+                                    ,GRHSs (unguardedRHS (comb3 $1 $2 $3) $2)
                                    (snd $ unLoc $3)) }
         | gdrhs wherebinds      { sLL $1 $>  (fst $ unLoc $2
                                     ,GRHSs (reverse (unLoc $1))



More information about the ghc-commits mailing list