summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorDavid Luposchainsky <dluposchainsky@gmail.com>2015-11-24 12:45:00 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-24 14:02:58 +0100
commit6d147939628c8503d682ffbe2985ca435d7a7c1d (patch)
treeeb488f759377137f003a99c248a8d6dc2025b1c3 /testsuite/tests
parentc05fdddec71f9dc8ebe62d751ccf03367128072a (diff)
downloadhaskell-6d147939628c8503d682ffbe2985ca435d7a7c1d.tar.gz
Add -Wcompat warning flag group
Reviewers: hvr, austin, thomie, bgamari Reviewed By: hvr, austin, thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1495 GHC Trac Issues: #11000
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs12
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs12
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs12
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr21
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs12
-rw-r--r--testsuite/tests/wcompat-warnings/all.T4
6 files changed, 73 insertions, 0 deletions
diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs
new file mode 100644
index 0000000000..2f86d46bc2
--- /dev/null
+++ b/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs
@@ -0,0 +1,12 @@
+-- Test purpose:
+-- Ensure that not using -Wcompat does not enable its warnings
+
+-- {-# OPTIONS_GHC -Wcompat #-}
+-- {-# OPTIONS_GHC -Wno-compat #-}
+
+module WCompatWarningsNotOn where
+
+monadFail :: Monad m => m a
+monadFail = do
+ Just _ <- undefined
+ undefined
diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs
new file mode 100644
index 0000000000..727a4e7600
--- /dev/null
+++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs
@@ -0,0 +1,12 @@
+-- Test purpose:
+-- Ensure that using -Wno-compat does not switch on warnings
+
+-- {-# OPTIONS_GHC -Wcompat #-}
+{-# OPTIONS_GHC -Wno-compat #-}
+
+module WCompatWarningsOff where
+
+monadFail :: Monad m => m a
+monadFail = do
+ Just _ <- undefined
+ undefined
diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs
new file mode 100644
index 0000000000..29fcc9eeb3
--- /dev/null
+++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs
@@ -0,0 +1,12 @@
+-- Test purpose:
+-- Ensure that -Wcompat switches on the right warnings
+
+{-# OPTIONS_GHC -Wcompat #-}
+-- {-# OPTIONS_GHC -Wno-compat #-}
+
+module WCompatWarningsOn where
+
+monadFail :: Monad m => m a
+monadFail = do
+ Just _ <- undefined
+ undefined
diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr
new file mode 100644
index 0000000000..03fc4e26c1
--- /dev/null
+++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr
@@ -0,0 +1,21 @@
+
+WCompatWarningsOn.hs:11:5: warning:
+ Could not deduce (MonadFail m)
+ arising from the failable pattern ‘Just _’
+ (this will become an error a future GHC release)
+ from the context: Monad m
+ bound by the type signature for:
+ monadFail :: Monad m => m a
+ at WCompatWarningsOn.hs:9:14-27
+ Possible fix:
+ add (MonadFail m) to the context of
+ the type signature for:
+ monadFail :: Monad m => m a
+ In a stmt of a 'do' block: Just _ <- undefined
+ In the expression:
+ do { Just _ <- undefined;
+ undefined }
+ In an equation for ‘monadFail’:
+ monadFail
+ = do { Just _ <- undefined;
+ undefined }
diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs
new file mode 100644
index 0000000000..26d3973702
--- /dev/null
+++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs
@@ -0,0 +1,12 @@
+-- Test purpose:
+-- Ensure that -Wno-compat disables a previously set -Wcompat
+
+{-# OPTIONS_GHC -Wcompat #-}
+{-# OPTIONS_GHC -Wno-compat #-}
+
+module WCompatWarningsOnOff where
+
+monadFail :: Monad m => m a
+monadFail = do
+ Just _ <- undefined
+ undefined
diff --git a/testsuite/tests/wcompat-warnings/all.T b/testsuite/tests/wcompat-warnings/all.T
new file mode 100644
index 0000000000..4447f994cb
--- /dev/null
+++ b/testsuite/tests/wcompat-warnings/all.T
@@ -0,0 +1,4 @@
+test('WCompatWarningsOn', normal, compile, [''])
+test('WCompatWarningsOff', normal, compile, [''])
+test('WCompatWarningsNotOn', normal, compile, [''])
+test('WCompatWarningsOnOff', normal, compile, [''])