[commit: ghc] master: Simplify Core output with -dsuppress-type-signatures (8a0fca0)
git at git.haskell.org
git at git.haskell.org
Mon Dec 24 12:02:59 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/8a0fca09565df99474568888253415f9bbe0fb68/ghc
>---------------------------------------------------------------
commit 8a0fca09565df99474568888253415f9bbe0fb68
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Mon Dec 24 15:02:27 2018 +0300
Simplify Core output with -dsuppress-type-signatures
Currently we duplicate top-level binder ids for no reason:
$fEqHsExpr_$c/=
$fEqHsExpr_$c/=
= \ @ id_a27U $dEq_a27V eta_B2 eta1_B1 ->
case $fEqHsExpr_$c== $dEq_a27V eta_B2 eta1_B1 of {
False -> True;
True -> False
}
with this patch we drop the first line when type signatures are not
printed (-dsuppress-type-signatures, which is implied by -dsuppress-all)
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5472
>---------------------------------------------------------------
8a0fca09565df99474568888253415f9bbe0fb68
compiler/coreSyn/PprCore.hs | 8 +++++++-
testsuite/tests/simplCore/should_compile/T16038/T16038.stdout | 3 ---
testsuite/tests/simplCore/should_compile/T5996.stdout | 1 -
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs
index f22d803..5fe033b 100644
--- a/compiler/coreSyn/PprCore.hs
+++ b/compiler/coreSyn/PprCore.hs
@@ -115,7 +115,13 @@ ppr_bind ann (Rec binds) = vcat (map pp binds)
ppr_binding :: OutputableBndr b => Annotation b -> (b, Expr b) -> SDoc
ppr_binding ann (val_bdr, expr)
- = ann expr $$ pprBndr LetBind val_bdr $$ pp_bind
+ = sdocWithDynFlags $ \dflags ->
+ vcat [ ann expr
+ , if gopt Opt_SuppressTypeSignatures dflags
+ then empty
+ else pprBndr LetBind val_bdr
+ , pp_bind
+ ]
where
pp_bind = case bndrIsJoin_maybe val_bdr of
Nothing -> pp_normal_bind
diff --git a/testsuite/tests/simplCore/should_compile/T16038/T16038.stdout b/testsuite/tests/simplCore/should_compile/T16038/T16038.stdout
index f52fd1b..eec60ec 100644
--- a/testsuite/tests/simplCore/should_compile/T16038/T16038.stdout
+++ b/testsuite/tests/simplCore/should_compile/T16038/T16038.stdout
@@ -1,8 +1,5 @@
Rec {
$fEqHsExpr_$c/=
-$fEqHsExpr_$c/=
-$fEqHsExpr
$fEqHsExpr
$fEqHsExpr_$c==
-$fEqHsExpr_$c==
end Rec }
diff --git a/testsuite/tests/simplCore/should_compile/T5996.stdout b/testsuite/tests/simplCore/should_compile/T5996.stdout
index b8a3398..e56cd1f 100644
--- a/testsuite/tests/simplCore/should_compile/T5996.stdout
+++ b/testsuite/tests/simplCore/should_compile/T5996.stdout
@@ -1,2 +1 @@
-y2
y2 = x2
More information about the ghc-commits
mailing list