diff options
author | Aaron Allen <aaron@flipstone.com> | 2021-05-04 21:35:11 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-06 12:44:43 -0400 |
commit | 0281dae8b3fe3384939c415ae72ca2440b3cafb3 (patch) | |
tree | e4dd89beaa5ba386fd11d719ea15d1f4bde35cea /testsuite | |
parent | 87d8c008eeb8ff733ac0bfcfdbb0f1a758a417b9 (diff) | |
download | haskell-0281dae8b3fe3384939c415ae72ca2440b3cafb3.tar.gz |
Disallow -XDerivingVia when -XSafe is on (#19786)
Since `GeneralizedNewtypeDeriving` is considered unsafe, `DerivingVia`
should be as well.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/safeHaskell/safeLanguage/SafeLang19.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/safeHaskell/safeLanguage/all.T | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.hs b/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.hs new file mode 100644 index 0000000000..915876a838 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Haskell2010 #-} +{-# LANGUAGE Safe, DerivingVia #-} + +-- | Tests that Safe disables DerivingVia (#19786) +module SafeLang19 where + +f :: Int +f = 1 diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr new file mode 100644 index 0000000000..1dbe65d156 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr @@ -0,0 +1,3 @@ + +SafeLang19.hs:2:20: warning: + -XDerivingVia is not allowed in Safe Haskell; ignoring -XDerivingVia diff --git a/testsuite/tests/safeHaskell/safeLanguage/all.T b/testsuite/tests/safeHaskell/safeLanguage/all.T index de4a9b6908..ac15d88a21 100644 --- a/testsuite/tests/safeHaskell/safeLanguage/all.T +++ b/testsuite/tests/safeHaskell/safeLanguage/all.T @@ -32,6 +32,7 @@ test('SafeLang16', normal, compile, ['']) test('SafeLang17', [], multimod_compile_fail, ['SafeLang17', '']) test('SafeLang18', normal, compile, ['']) +test('SafeLang19', normal, compile, ['']) # Test building a package, that trust values are set correctly # and can be changed correctly |