[commit: ghc] master: supress warning of bang wildcard pattern-binding (i.e. let !_ = rhs). This fixes #9127 (fbdebd3)

git at git.haskell.org git at git.haskell.org
Fri Jun 6 21:44:53 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/fbdebd30b9ff3ca76243791723b85959c6860083/ghc

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

commit fbdebd30b9ff3ca76243791723b85959c6860083
Author: Guido Zayas <guido.zayas at gmail.com>
Date:   Fri Jun 6 18:34:14 2014 +0200

    supress warning of bang wildcard pattern-binding (i.e. let !_ = rhs). This fixes #9127


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

fbdebd30b9ff3ca76243791723b85959c6860083
 compiler/rename/RnBinds.lhs                                          | 5 +++--
 testsuite/tests/rename/should_compile/T9127.hs                       | 5 +++++
 .../tests/rename/should_compile/T9127.stderr                         | 0
 testsuite/tests/rename/should_compile/all.T                          | 1 +
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index 7d3224e..e65d317 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 0000000..c8e827f
--- /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/libraries/base/tests/IO/misc001.stdout b/testsuite/tests/rename/should_compile/T9127.stderr
similarity index 100%
copy from libraries/base/tests/IO/misc001.stdout
copy to 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 0ce4ca1..4ed92bd 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, [''])



More information about the ghc-commits mailing list