summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorOleg Grenrus <oleg.grenrus@iki.fi>2023-01-09 21:57:03 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-12 15:54:21 -0500
commit1b812b6973a25cb1962e2fc543d2c4ed3cf31f3c (patch)
treed1922268e011e6acfa8c45a9ecd0ac6a98789d0e /testsuite
parent73bc162b8427bd34768615fda1c95c41e4797385 (diff)
downloadhaskell-1b812b6973a25cb1962e2fc543d2c4ed3cf31f3c.tar.gz
Fix #22728: Not all diagnostics in safe check are fatal
Also add tests for the issue and -Winferred-safe-imports in general
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/safeHaskell/warnings/Makefile3
-rw-r--r--testsuite/tests/safeHaskell/warnings/T22728.hs6
-rw-r--r--testsuite/tests/safeHaskell/warnings/T22728.stderr4
-rw-r--r--testsuite/tests/safeHaskell/warnings/T22728_B.hs6
-rw-r--r--testsuite/tests/safeHaskell/warnings/T22728b.hs6
-rw-r--r--testsuite/tests/safeHaskell/warnings/T22728b.stderr4
-rw-r--r--testsuite/tests/safeHaskell/warnings/T22728b_B.hs6
-rw-r--r--testsuite/tests/safeHaskell/warnings/all.T2
8 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/warnings/Makefile b/testsuite/tests/safeHaskell/warnings/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/safeHaskell/warnings/T22728.hs b/testsuite/tests/safeHaskell/warnings/T22728.hs
new file mode 100644
index 0000000000..bd24e88d6d
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/T22728.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE Safe #-}
+{-# LANGUAGE Haskell2010 #-}
+{-# OPTIONS_GHC -Winferred-safe-imports #-}
+module T22728 (module T22728_B) where
+
+import T22728_B
diff --git a/testsuite/tests/safeHaskell/warnings/T22728.stderr b/testsuite/tests/safeHaskell/warnings/T22728.stderr
new file mode 100644
index 0000000000..310749eee2
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/T22728.stderr
@@ -0,0 +1,4 @@
+[2 of 2] Compiling T22728 ( T22728.hs, T22728.o )
+
+T22728.hs:6:1: warning: [GHC-82658] [-Winferred-safe-imports]
+ Importing Safe-Inferred module T22728_B from explicitly Safe module
diff --git a/testsuite/tests/safeHaskell/warnings/T22728_B.hs b/testsuite/tests/safeHaskell/warnings/T22728_B.hs
new file mode 100644
index 0000000000..2673100932
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/T22728_B.hs
@@ -0,0 +1,6 @@
+-- inferred safe
+{-# LANGUAGE Haskell2010 #-}
+module T22728_B where
+
+int :: Int
+int = 3
diff --git a/testsuite/tests/safeHaskell/warnings/T22728b.hs b/testsuite/tests/safeHaskell/warnings/T22728b.hs
new file mode 100644
index 0000000000..4580fdbeb8
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/T22728b.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE Safe #-}
+{-# LANGUAGE Haskell2010 #-}
+{-# OPTIONS_GHC -Werror=inferred-safe-imports #-}
+module T22728b (module T22728b_B) where
+
+import T22728b_B
diff --git a/testsuite/tests/safeHaskell/warnings/T22728b.stderr b/testsuite/tests/safeHaskell/warnings/T22728b.stderr
new file mode 100644
index 0000000000..e1fc69da6c
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/T22728b.stderr
@@ -0,0 +1,4 @@
+[2 of 2] Compiling T22728b ( T22728b.hs, T22728b.o )
+
+T22728b.hs:6:1: error: [GHC-82658] [-Winferred-safe-imports, Werror=inferred-safe-imports]
+ Importing Safe-Inferred module T22728b_B from explicitly Safe module
diff --git a/testsuite/tests/safeHaskell/warnings/T22728b_B.hs b/testsuite/tests/safeHaskell/warnings/T22728b_B.hs
new file mode 100644
index 0000000000..882629c2f6
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/T22728b_B.hs
@@ -0,0 +1,6 @@
+-- inferred safe
+{-# LANGUAGE Haskell2010 #-}
+module T22728b_B where
+
+int :: Int
+int = 3
diff --git a/testsuite/tests/safeHaskell/warnings/all.T b/testsuite/tests/safeHaskell/warnings/all.T
new file mode 100644
index 0000000000..f32154d6c5
--- /dev/null
+++ b/testsuite/tests/safeHaskell/warnings/all.T
@@ -0,0 +1,2 @@
+test('T22728', normal, multi_compile, ['T22728.hs', [('T22728_B.hs', '')], ''])
+test('T22728b', normal, multi_compile_fail, ['T22728b.hs', [('T22728b_B.hs', '')], ''])