summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename/should_fail
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rename/should_fail')
-rw-r--r--testsuite/tests/rename/should_fail/T15957_Fail.hs11
-rw-r--r--testsuite/tests/rename/should_fail/T15957_Fail.stderr9
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
3 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_fail/T15957_Fail.hs b/testsuite/tests/rename/should_fail/T15957_Fail.hs
new file mode 100644
index 0000000000..9c7ff6d8b6
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T15957_Fail.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE NamedFieldPuns #-}
+module T15957_Fail where
+
+data P = P { x :: Int, y :: Int }
+
+f1 P{..} = 1 + 3 -- nothing bound is used
+f2 P{x, ..} = x + 3 -- y bound but not used
+f3 P{x, y, ..} = x + y -- no bindings left, i.e. no new useful bindings introduced
+
+
diff --git a/testsuite/tests/rename/should_fail/T15957_Fail.stderr b/testsuite/tests/rename/should_fail/T15957_Fail.stderr
new file mode 100644
index 0000000000..6bebb08981
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T15957_Fail.stderr
@@ -0,0 +1,9 @@
+
+T15957_Fail.hs:7:4: error: [-Wunused-record-wildcards, -Werror=unused-record-wildcards]
+ No variables bound in the record wildcard match are used
+
+T15957_Fail.hs:8:4: error: [-Wunused-record-wildcards, -Werror=unused-record-wildcards]
+ No variables bound in the record wildcard match are used
+
+T15957_Fail.hs:9:4: error: [-Wredundant-record-wildcards, -Werror=redundant-record-wildcards]
+ Record wildcard does not bind any new variables
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index ce8c5c9a13..b5b244680e 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -145,3 +145,4 @@ test('T16002', normal, compile_fail, [''])
test('T16114', normal, compile_fail, [''])
test('T16116b', normal, compile_fail, [''])
test('ExplicitForAllRules2', normal, compile_fail, [''])
+test('T15957_Fail', normal, compile_fail, ['-Werror -Wredundant-record-wildcards -Wunused-record-wildcards'])