diff options
author | chessai <chessai1996@gmail.com> | 2018-12-26 12:12:37 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-01-06 07:27:09 -0500 |
commit | c121e33f9b039acf2ac6939af8bfafe593560039 (patch) | |
tree | bb61fb561f3fce2c0f5d8d90884e76d5297bc609 /testsuite/tests/rename | |
parent | 08b8ea2f4f1bbc1c61a7cca03ae7fa8ffb099556 (diff) | |
download | haskell-c121e33f9b039acf2ac6939af8bfafe593560039.tar.gz |
Add -Wmissing-deriving-strategies
Warn users when -XDerivingStrategies is enabled but not used, at each
potential use site.
add -Wmissing-deriving-strategies
Reviewers: bgamari, RyanGlScott
Subscribers: andrewthad, rwbarton, carter
GHC Trac Issues: #15798
Differential Revision: https://phabricator.haskell.org/D5451
Diffstat (limited to 'testsuite/tests/rename')
7 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T15798a.hs b/testsuite/tests/rename/should_compile/T15798a.hs new file mode 100644 index 0000000000..d34e55bdab --- /dev/null +++ b/testsuite/tests/rename/should_compile/T15798a.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE DerivingStrategies #-} + +{-# OPTIONS_GHC -Wmissing-deriving-strategies #-} + +module T15798a () where + +data Foo a = Foo a + deriving stock (Eq) + +data Bar a = Bar a + deriving (Eq, Show) + deriving stock (Ord) diff --git a/testsuite/tests/rename/should_compile/T15798a.stderr b/testsuite/tests/rename/should_compile/T15798a.stderr new file mode 100644 index 0000000000..6832205228 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T15798a.stderr @@ -0,0 +1,3 @@ + +T15798a.hs:11:3: warning: [-Wmissing-deriving-strategies] + No deriving strategy specified. Did you want stock, newtype, or anyclass? diff --git a/testsuite/tests/rename/should_compile/T15798b.hs b/testsuite/tests/rename/should_compile/T15798b.hs new file mode 100644 index 0000000000..8504d6fee1 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T15798b.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneDeriving #-} + +{-# OPTIONS_GHC -Wmissing-deriving-strategies #-} + +module T15798b () where + +data Foo a = Foo a + +deriving instance Eq a => Eq (Foo a) diff --git a/testsuite/tests/rename/should_compile/T15798b.stderr b/testsuite/tests/rename/should_compile/T15798b.stderr new file mode 100644 index 0000000000..de1b09ee48 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T15798b.stderr @@ -0,0 +1,4 @@ + +T15798b.hs:9:19: warning: [-Wmissing-deriving-strategies] + No deriving strategy specified. Did you want stock, newtype, or anyclass? + Use DerivingStrategies to specify a strategy. diff --git a/testsuite/tests/rename/should_compile/T15798c.hs b/testsuite/tests/rename/should_compile/T15798c.hs new file mode 100644 index 0000000000..f3048eded5 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T15798c.hs @@ -0,0 +1,6 @@ +{-# OPTIONS_GHC -Wmissing-deriving-strategies #-} + +module T15798c () where + +data Foo a = Foo a + deriving (Eq) diff --git a/testsuite/tests/rename/should_compile/T15798c.stderr b/testsuite/tests/rename/should_compile/T15798c.stderr new file mode 100644 index 0000000000..868266aa3a --- /dev/null +++ b/testsuite/tests/rename/should_compile/T15798c.stderr @@ -0,0 +1,4 @@ + +T15798c.hs:6:3: warning: [-Wmissing-deriving-strategies] + No deriving strategy specified. Did you want stock, newtype, or anyclass? + Use DerivingStrategies to specify a strategy. diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T index b6c06c151c..0bcd25ccf1 100644 --- a/testsuite/tests/rename/should_compile/all.T +++ b/testsuite/tests/rename/should_compile/all.T @@ -163,3 +163,7 @@ test('T14747', [], multimod_compile, ['T14747', '-v0']) test('T15149', [], multimod_compile, ['T15149', '-v0']) test('T13064', normal, compile, ['']) test('T15994', [], run_command, ['$MAKE -s --no-print-directory T15994']) +test('T15798a', normal, compile, ['']) +test('T15798b', normal, compile, ['']) +test('T15798c', normal, compile, ['']) + |