[commit: ghc] master: GRHS with empty wherebinds gets wrong SrcSpan (d4f25cb)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d4f25cb151db1a539aab66b26ccca4d166562b22/ghc

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

commit d4f25cb151db1a539aab66b26ccca4d166562b22
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


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

d4f25cb151db1a539aab66b26ccca4d166562b22
 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