summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorAaron Allen <aaron@flipstone.com>2021-05-04 21:35:11 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-06 12:44:43 -0400
commit0281dae8b3fe3384939c415ae72ca2440b3cafb3 (patch)
treee4dd89beaa5ba386fd11d719ea15d1f4bde35cea /testsuite
parent87d8c008eeb8ff733ac0bfcfdbb0f1a758a417b9 (diff)
downloadhaskell-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.hs8
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr3
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/all.T1
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