[commit: ghc] wip/T13255-spj: Fix Core pretty printer (da89de7)

git at git.haskell.org git at git.haskell.org
Fri Feb 17 15:09:07 UTC 2017


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

On branch  : wip/T13255-spj
Link       : http://ghc.haskell.org/trac/ghc/changeset/da89de72847c2baeebeb81933fe43158b2d4d8a3/ghc

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

commit da89de72847c2baeebeb81933fe43158b2d4d8a3
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Feb 17 14:56:13 2017 +0000

    Fix Core pretty printer
    
    If a JoinId (bogusly) ends up in an argument position we printed
        f jump j
    rather than
        f (jump j)
    
    Easy to fix.


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

da89de72847c2baeebeb81933fe43158b2d4d8a3
 compiler/coreSyn/PprCore.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs
index 994c237..30de5d2 100644
--- a/compiler/coreSyn/PprCore.hs
+++ b/compiler/coreSyn/PprCore.hs
@@ -148,8 +148,9 @@ ppr_expr :: OutputableBndr b => (SDoc -> SDoc) -> Expr b -> SDoc
         -- The function adds parens in context that need
         -- an atomic value (e.g. function args)
 
-ppr_expr _       (Var name)    = ppWhen (isJoinId name) (text "jump") <+>
-                                   ppr name
+ppr_expr add_par (Var name)
+ | isJoinId name               = add_par ((text "jump") <+> ppr name)
+ | otherwise                   = ppr name
 ppr_expr add_par (Type ty)     = add_par (text "TYPE:" <+> ppr ty)       -- Weird
 ppr_expr add_par (Coercion co) = add_par (text "CO:" <+> ppr co)
 ppr_expr add_par (Lit lit)     = pprLiteral add_par lit



More information about the ghc-commits mailing list