summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorZachary Wood <zac.wood9@gmail.com>2022-08-14 22:13:38 -0700
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-19 14:17:28 -0400
commit9789e8454ad9f315169063b344a56c4216c12711 (patch)
treed1abe617870bfcb673f8a7a18dc91c68df49cec5 /testsuite
parent9a7e2ea1684c3a3ac91e4cdbb07b9d217f58dd4c (diff)
downloadhaskell-9789e8454ad9f315169063b344a56c4216c12711.tar.gz
tc: warn about lazy annotations on unlifted arguments (fixes #21951)
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/typecheck/should_compile/T21951a.hs10
-rw-r--r--testsuite/tests/typecheck/should_compile/T21951a.stderr4
-rw-r--r--testsuite/tests/typecheck/should_compile/T21951b.hs13
-rw-r--r--testsuite/tests/typecheck/should_compile/T21951b.stderr4
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T2
5 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T21951a.hs b/testsuite/tests/typecheck/should_compile/T21951a.hs
new file mode 100644
index 0000000000..fb4bd85422
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T21951a.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE UnliftedDatatypes #-}
+{-# LANGUAGE StrictData #-}
+{-# LANGUAGE MagicHash #-}
+
+module Wibble where
+
+import Data.Kind
+import GHC.Exts
+
+data UA = UA ~(Array# Int)
diff --git a/testsuite/tests/typecheck/should_compile/T21951a.stderr b/testsuite/tests/typecheck/should_compile/T21951a.stderr
new file mode 100644
index 0000000000..d6afb5465e
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T21951a.stderr
@@ -0,0 +1,4 @@
+T21951a.hs:10:11: warning: [-Wredundant-strictness-flags]
+ Lazy flag has no effect on unlifted type ‘Array# Int’
+ In the definition of data constructor ‘UA’
+ In the data type declaration for ‘UA’
diff --git a/testsuite/tests/typecheck/should_compile/T21951b.hs b/testsuite/tests/typecheck/should_compile/T21951b.hs
new file mode 100644
index 0000000000..de975e3843
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T21951b.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE UnliftedDatatypes #-}
+{-# LANGUAGE StrictData #-}
+{-# LANGUAGE MagicHash #-}
+
+module Wibble where
+
+import Data.Kind
+import GHC.Exts
+
+type U :: UnliftedType
+data U = MkU Int
+
+data T = T ~U
diff --git a/testsuite/tests/typecheck/should_compile/T21951b.stderr b/testsuite/tests/typecheck/should_compile/T21951b.stderr
new file mode 100644
index 0000000000..f26dbe8ce2
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T21951b.stderr
@@ -0,0 +1,4 @@
+T21951b.hs:13:10: warning: [-Wredundant-strictness-flags]
+ Lazy flag has no effect on unlifted type ‘U’
+ In the definition of data constructor ‘T’
+ In the data type declaration for ‘T’
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 22c5dc2647..dae6e5bca7 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -853,3 +853,5 @@ test('DeepSubsumption06', normal, compile, ['-XHaskell98'])
test('DeepSubsumption07', normal, compile, ['-XHaskell2010'])
test('DeepSubsumption08', normal, compile, [''])
test('DeepSubsumption09', normal, compile, [''])
+test('T21951a', normal, compile, ['-Wredundant-strictness-flags'])
+test('T21951b', normal, compile, ['-Wredundant-strictness-flags'])