[commit: ghc] ghc-7.10: Bring Match m_fun_id_infix through the renamer. (29bb156)

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


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

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/29bb15667755d9d71fd92e63e63305068f6fdafb/ghc

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

commit 29bb15667755d9d71fd92e63e63305068f6fdafb
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Thu Feb 5 17:36:57 2015 -0600

    Bring Match m_fun_id_infix through the renamer.
    
    Summary:
    This is a first step for #9988
    
    It turns out that bringing m_fun_id_infix through the renamer is
    actually very simple, affecting the internals of rnMatch' only.
    
    Is this simple enough to hit 7.10.1?
    
    Test Plan: ./validate
    
    Reviewers: hvr, simonpj, austin
    
    Reviewed By: simonpj, austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D639
    
    GHC Trac Issues: #9988
    
    (cherry picked from commit c88e11219c1e914b71d8c630a1f1d4f6f0fb6b9b)


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

29bb15667755d9d71fd92e63e63305068f6fdafb
 compiler/rename/RnBinds.hs                         | 11 ++++++++---
 testsuite/tests/ghc-api/landmines/landmines.stdout |  6 +++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/compiler/rename/RnBinds.hs b/compiler/rename/RnBinds.hs
index 7a9dcae..397780c 100644
--- a/compiler/rename/RnBinds.hs
+++ b/compiler/rename/RnBinds.hs
@@ -978,7 +978,8 @@ rnMatch' :: Outputable (body RdrName) => HsMatchContext Name
          -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars))
          -> Match RdrName (Located (body RdrName))
          -> RnM (Match Name (Located (body Name)), FreeVars)
-rnMatch' ctxt rnBody match@(Match _mf pats maybe_rhs_sig grhss)
+rnMatch' ctxt rnBody match@(Match { m_fun_id_infix = mf, m_pats = pats
+                                  , m_type = maybe_rhs_sig, m_grhss = grhss })
   = do  {       -- Result type signatures are no longer supported
           case maybe_rhs_sig of
                 Nothing -> return ()
@@ -988,8 +989,12 @@ rnMatch' ctxt rnBody match@(Match _mf pats maybe_rhs_sig grhss)
                -- note that there are no local ficity decls for matches
         ; rnPats ctxt pats      $ \ pats' -> do
         { (grhss', grhss_fvs) <- rnGRHSs ctxt rnBody grhss
-
-        ; return (Match Nothing pats' Nothing grhss', grhss_fvs) }}
+        ; let mf' = case (ctxt,mf) of
+                      (FunRhs funid isinfix,Just (L lf _,_))
+                                                    -> Just (L lf funid,isinfix)
+                      _                             -> Nothing
+        ; return (Match { m_fun_id_infix = mf', m_pats = pats'
+                        , m_type = Nothing, m_grhss = grhss'}, grhss_fvs ) }}
 
 emptyCaseErr :: HsMatchContext Name -> SDoc
 emptyCaseErr ctxt = hang (ptext (sLit "Empty list of alternatives in") <+> pp_ctxt)
diff --git a/testsuite/tests/ghc-api/landmines/landmines.stdout b/testsuite/tests/ghc-api/landmines/landmines.stdout
index fc53814..7d667ed 100644
--- a/testsuite/tests/ghc-api/landmines/landmines.stdout
+++ b/testsuite/tests/ghc-api/landmines/landmines.stdout
@@ -1,4 +1,4 @@
-(10,9,6)
+(10,10,6)
 (49,45,0)
-(12,10,6)
-(8,7,6)
+(12,11,6)
+(8,8,6)



More information about the ghc-commits mailing list