[commit: ghc] wip/orf-reboot: Add test for deprecation warnings on non-duplicate fields (22349a7)

git at git.haskell.org git at git.haskell.org
Mon Oct 12 06:37:45 UTC 2015


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

On branch  : wip/orf-reboot
Link       : http://ghc.haskell.org/trac/ghc/changeset/22349a76a42b0b34c77280e8309c6b0260d1a924/ghc

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

commit 22349a76a42b0b34c77280e8309c6b0260d1a924
Author: Adam Gundry <adam at well-typed.com>
Date:   Fri Oct 9 13:46:18 2015 +0100

    Add test for deprecation warnings on non-duplicate fields


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

22349a76a42b0b34c77280e8309c6b0260d1a924
 .../should_fail/OverloadedRecFldsFail12_A.hs                |  5 +++++
 testsuite/tests/overloadedrecflds/should_fail/all.T         |  3 +++
 .../should_fail/overloadedrecfldsfail12.hs                  | 12 ++++++++++++
 .../should_fail/overloadedrecfldsfail12.stderr              | 13 +++++++++++++
 4 files changed, 33 insertions(+)

diff --git a/testsuite/tests/overloadedrecflds/should_fail/OverloadedRecFldsFail12_A.hs b/testsuite/tests/overloadedrecflds/should_fail/OverloadedRecFldsFail12_A.hs
new file mode 100644
index 0000000..2c69e67
--- /dev/null
+++ b/testsuite/tests/overloadedrecflds/should_fail/OverloadedRecFldsFail12_A.hs
@@ -0,0 +1,5 @@
+module OverloadedRecFldsFail12_A where
+
+{-# WARNING foo "Deprecated foo" #-}
+{-# WARNING bar "Deprecated bar" #-}
+data T = MkT { foo :: Int, bar :: Int }
diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T
index db689e5..fe7a85a 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/all.T
+++ b/testsuite/tests/overloadedrecflds/should_fail/all.T
@@ -17,3 +17,6 @@ test('overloadedrecfldsfail10',
                  , 'OverloadedRecFldsFail10_C.hi', 'OverloadedRecFldsFail10_C.o']),
      multimod_compile_fail, ['overloadedrecfldsfail10', ''])
 test('overloadedrecfldsfail11', normal, compile_fail, [''])
+test('overloadedrecfldsfail12',
+     extra_clean(['OverloadedRecFldsFail12_A.hi', 'OverloadedRecFldsFail12_A.o']),
+     multimod_compile_fail, ['overloadedrecfldsfail12', ''])
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.hs b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.hs
new file mode 100644
index 0000000..0516e43
--- /dev/null
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# OPTIONS_GHC -Werror #-}
+
+import OverloadedRecFldsFail12_A
+
+data S = MkS { foo :: Bool }
+
+-- Use of foo and bar should give deprecation warnings
+f :: T -> T
+f e = e { foo = 3, bar = 3 }
+
+main = return ()
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr
new file mode 100644
index 0000000..65733ed
--- /dev/null
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr
@@ -0,0 +1,13 @@
+[1 of 2] Compiling OverloadedRecFldsFail12_A ( OverloadedRecFldsFail12_A.hs, OverloadedRecFldsFail12_A.o )
+[2 of 2] Compiling Main             ( overloadedrecfldsfail12.hs, overloadedrecfldsfail12.o )
+
+overloadedrecfldsfail12.hs:10:11: warning:
+    In the use of ‘foo’ (imported from OverloadedRecFldsFail12_A):
+    "Deprecated foo"
+
+overloadedrecfldsfail12.hs:10:20: warning:
+    In the use of ‘bar’ (imported from OverloadedRecFldsFail12_A):
+    "Deprecated bar"
+
+<no location info>: error: 
+Failing due to -Werror.



More information about the ghc-commits mailing list