Test Trac #5892
authorSimon Peyton Jones <simonpj@microsoft.com>
Sun, 4 Mar 2012 09:38:28 +0000 (09:38 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Sun, 4 Mar 2012 09:38:28 +0000 (09:38 +0000)
testsuite/tests/rename/should_fail/T5892a.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/T5892a.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/T5892b.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/T5892b.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/all.T

diff --git a/testsuite/tests/rename/should_fail/T5892a.hs b/testsuite/tests/rename/should_fail/T5892a.hs
new file mode 100644 (file)
index 0000000..c0ad989
--- /dev/null
@@ -0,0 +1,12 @@
+{-# LANGUAGE RecordWildCards #-}
+{-# OPTIONS_GHC -Werror #-}
+
+module T5892a where
+
+import Data.Version ( Version( Version, versionBranch ))
+-- Not importing its field: versionTags
+
+foo :: Version -> Version
+foo (Version {..}) -- Pattern match does not bind versionTags 
+  = let versionBranch = []
+    in Version {..}   -- Hence warning here
diff --git a/testsuite/tests/rename/should_fail/T5892a.stderr b/testsuite/tests/rename/should_fail/T5892a.stderr
new file mode 100644 (file)
index 0000000..9eecad6
--- /dev/null
@@ -0,0 +1,10 @@
+\r
+T5892a.hs:12:8: Warning:\r
+    Fields of `Version' not initialised: Data.Version.versionTags\r
+    In the expression: Version {..}\r
+    In the expression: let versionBranch = [] in Version {..}\r
+    In an equation for `foo':\r
+        foo (Version {..}) = let versionBranch = [] in Version {..}\r
+\r
+<no location info>: \r
+Failing due to -Werror.\r
diff --git a/testsuite/tests/rename/should_fail/T5892b.hs b/testsuite/tests/rename/should_fail/T5892b.hs
new file mode 100644 (file)
index 0000000..6bcea27
--- /dev/null
@@ -0,0 +1,11 @@
+{-# LANGUAGE RecordWildCards #-}
+module T5892b where
+
+import Data.Version ( Version( Version, versionBranch ))
+-- Not importing its field: versionTags
+
+Version{..} = Version [] []
+-- Binds versionBranch only
+
+foo = T5892b.versionBranch
+bar = T5892b.versionTags
diff --git a/testsuite/tests/rename/should_fail/T5892b.stderr b/testsuite/tests/rename/should_fail/T5892b.stderr
new file mode 100644 (file)
index 0000000..10d6c36
--- /dev/null
@@ -0,0 +1,4 @@
+\r
+T5892b.hs:11:7:\r
+    Not in scope: `T5892b.versionTags'\r
+    Perhaps you meant `T5892b.versionBranch' (line 7)\r
index c0e4f54..c762efc 100644 (file)
@@ -99,3 +99,5 @@ test('T5657', normal, compile_fail, [''])
 test('T5745',
      extra_clean(['T5745a.hi', 'T5745a.o', 'T5745b.hi', 'T5745b.o']),
      multimod_compile_fail, ['T5745', '-v0'])
+test('T5892a', normal, compile_fail, [''])
+test('T5892b', normal, compile_fail, [''])