[commit: ghc] master: Fix Core pretty printer (3f653c1)
git at git.haskell.org
git at git.haskell.org
Mon Feb 20 18:41:53 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/3f653c1ec62eadaffd239391ce6b8411942daa50/ghc
>---------------------------------------------------------------
commit 3f653c1ec62eadaffd239391ce6b8411942daa50
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.
>---------------------------------------------------------------
3f653c1ec62eadaffd239391ce6b8411942daa50
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