[commit: ghc] master: Correctly pretty print a wild card in infix position (8f20844)
git at git.haskell.org
git at git.haskell.org
Sat Feb 25 13:45:34 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/8f20844d3435094583db92a30550ca319d2be863/ghc
>---------------------------------------------------------------
commit 8f20844d3435094583db92a30550ca319d2be863
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date: Sat Feb 25 15:42:40 2017 +0200
Correctly pretty print a wild card in infix position
>---------------------------------------------------------------
8f20844d3435094583db92a30550ca319d2be863
compiler/hsSyn/HsExpr.hs | 1 +
testsuite/tests/printer/Makefile | 4 ++++
.../tests/{typecheck/should_compile/T13050.hs => printer/T13050p.hs} | 0
testsuite/tests/printer/all.T | 1 +
4 files changed, 6 insertions(+)
diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs
index 71c4089..6ec0f0a 100644
--- a/compiler/hsSyn/HsExpr.hs
+++ b/compiler/hsSyn/HsExpr.hs
@@ -852,6 +852,7 @@ ppr_expr (OpApp e1 op _ e2)
should_print_infix (HsRecFld f) = Just (pprInfixOcc f)
should_print_infix (HsUnboundVar h at TrueExprHole{})
= Just (pprInfixOcc (unboundVarOcc h))
+ should_print_infix EWildPat = Just (text "`_`")
should_print_infix (HsWrap _ e) = should_print_infix e
should_print_infix _ = Nothing
diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile
index bc2a4ed..9f0eb23 100644
--- a/testsuite/tests/printer/Makefile
+++ b/testsuite/tests/printer/Makefile
@@ -201,3 +201,7 @@ ppr048:
.PHONY: T13199
T13199:
$(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13199.hs
+
+.PHONY: T13050p
+T13050p:
+ $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13050p.hs
diff --git a/testsuite/tests/typecheck/should_compile/T13050.hs b/testsuite/tests/printer/T13050p.hs
similarity index 100%
copy from testsuite/tests/typecheck/should_compile/T13050.hs
copy to testsuite/tests/printer/T13050p.hs
diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T
index 3106f93..e5fd00f 100644
--- a/testsuite/tests/printer/all.T
+++ b/testsuite/tests/printer/all.T
@@ -47,3 +47,4 @@ test('Ppr046', ignore_stderr, run_command, ['$MAKE -s --no-print-directory ppr04
test('Ppr047', expect_fail, run_command, ['$MAKE -s --no-print-directory ppr047'])
test('Ppr048', ignore_stderr, run_command, ['$MAKE -s --no-print-directory ppr048'])
test('T13199', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T13199'])
+test('T13050p', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T13050p'])
More information about the ghc-commits
mailing list