summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Zayas <guido.zayas@gmail.com>2014-06-06 18:34:14 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2014-06-06 19:22:06 +0200
commitfbdebd30b9ff3ca76243791723b85959c6860083 (patch)
treecf906fc3aabbc589b09c974872b2bddeffe42f72
parente577a52363ee7ee8a07f1d863988332ae8fbf2e4 (diff)
downloadhaskell-fbdebd30b9ff3ca76243791723b85959c6860083.tar.gz
supress warning of bang wildcard pattern-binding (i.e. let !_ = rhs). This fixes #9127
-rw-r--r--compiler/rename/RnBinds.lhs5
-rw-r--r--testsuite/tests/rename/should_compile/T9127.hs5
-rw-r--r--testsuite/tests/rename/should_compile/T9127.stderr0
-rw-r--r--testsuite/tests/rename/should_compile/all.T1
4 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index 7d3224e8cc..e65d3173d6 100644
--- a/compiler/rename/RnBinds.lhs
+++ b/compiler/rename/RnBinds.lhs
@@ -476,8 +476,9 @@ rnBind _ bind@(PatBind { pat_lhs = pat
bndrs = collectPatBinders pat
bind' = bind { pat_rhs = grhss', bind_fvs = fvs' }
is_wild_pat = case pat of
- L _ (WildPat {}) -> True
- _ -> False
+ L _ (WildPat {}) -> True
+ L _ (BangPat (L _ (WildPat {}))) -> True -- #9127
+ _ -> False
-- Warn if the pattern binds no variables, except for the
-- entirely-explicit idiom _ = rhs
diff --git a/testsuite/tests/rename/should_compile/T9127.hs b/testsuite/tests/rename/should_compile/T9127.hs
new file mode 100644
index 0000000000..c8e827f888
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T9127.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE BangPatterns #-}
+module T9127 where
+
+f = let !_ = 2 * 2
+ in 2*2
diff --git a/testsuite/tests/rename/should_compile/T9127.stderr b/testsuite/tests/rename/should_compile/T9127.stderr
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T9127.stderr
diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T
index 0ce4ca125d..4ed92bd328 100644
--- a/testsuite/tests/rename/should_compile/all.T
+++ b/testsuite/tests/rename/should_compile/all.T
@@ -214,3 +214,4 @@ test('T7969',
'T7969.imports'])],
run_command,
['$MAKE -s --no-print-directory T7969'])
+test('T9127', normal, compile, [''])