summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/type-data/should_fail/TDTagToEnum.hs10
-rw-r--r--testsuite/tests/type-data/should_fail/TDTagToEnum.stderr6
-rw-r--r--testsuite/tests/type-data/should_fail/all.T1
3 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/type-data/should_fail/TDTagToEnum.hs b/testsuite/tests/type-data/should_fail/TDTagToEnum.hs
new file mode 100644
index 0000000000..ef0ba0b496
--- /dev/null
+++ b/testsuite/tests/type-data/should_fail/TDTagToEnum.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE TypeData #-}
+module TDTagToEnum where
+
+import GHC.Exts (tagToEnum#)
+
+type data Letter = A | B | C
+
+f :: Letter
+f = tagToEnum# 0#
diff --git a/testsuite/tests/type-data/should_fail/TDTagToEnum.stderr b/testsuite/tests/type-data/should_fail/TDTagToEnum.stderr
new file mode 100644
index 0000000000..d8ddbbeb47
--- /dev/null
+++ b/testsuite/tests/type-data/should_fail/TDTagToEnum.stderr
@@ -0,0 +1,6 @@
+
+TDTagToEnum.hs:10:5: error: [GHC-96189]
+ • Bad call to tagToEnum# at type Letter
+ Result type cannot be headed by a `type data` type
+ • In the expression: tagToEnum# 0#
+ In an equation for ‘f’: f = tagToEnum# 0#
diff --git a/testsuite/tests/type-data/should_fail/all.T b/testsuite/tests/type-data/should_fail/all.T
index 82b257df22..870e4ea991 100644
--- a/testsuite/tests/type-data/should_fail/all.T
+++ b/testsuite/tests/type-data/should_fail/all.T
@@ -11,4 +11,5 @@ test('TDRecordsH98', normal, compile_fail, [''])
test('TDRecursive', normal, compile_fail, [''])
test('TDStrictnessGADT', normal, compile_fail, [''])
test('TDStrictnessH98', normal, compile_fail, [''])
+test('TDTagToEnum', normal, compile_fail, [''])
test('T22332b', normal, compile_fail, [''])