summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename/should_compile/T19984.hs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-04-01 12:02:46 +0200
committerMatthew Pickering <matthewtpickering@gmail.com>2022-04-01 11:17:56 +0100
commitd85c7dcb7c457efc23b20ac8f4e4ae88bae5b050 (patch)
tree6a052785be9dd3b67e42637102de21f0630f6ddf /testsuite/tests/rename/should_compile/T19984.hs
parent950f58e7bf584ec6970327ac7c7ae3f3fdbc9882 (diff)
downloadhaskell-d85c7dcb7c457efc23b20ac8f4e4ae88bae5b050.tar.gz
Keep track of promotion ticks in HsOpTywip/no-c-stubswip/matt-merge-batch
This patch adds a PromotionFlag field to HsOpTy, which is used in pretty-printing and when determining whether to emit warnings with -fwarn-unticked-promoted-constructors. This allows us to correctly report tick-related warnings for things like: type A = Int : '[] type B = [Int, Bool] Updates haddock submodule Fixes #19984
Diffstat (limited to 'testsuite/tests/rename/should_compile/T19984.hs')
-rw-r--r--testsuite/tests/rename/should_compile/T19984.hs34
1 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T19984.hs b/testsuite/tests/rename/should_compile/T19984.hs
new file mode 100644
index 0000000000..355fcdda64
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T19984.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeOperators #-}
+
+module T19984 where
+
+data D a = (:-) a a
+
+-- promoted datacons missing promotion tick
+-- (should give warnings with -fwarn-unticked-promoted-constructors)
+type A1 = Int : '[]
+type B1 = [Int, Bool]
+type C1 = (:) Int '[]
+type E1 = Int :- Bool
+type F1 = (:-) Int Bool
+
+-- promoted datacons with promotion ticks
+-- (no warnings)
+type A2 = Int ': '[]
+type B2 = '[Int, Bool]
+type C2 = '(:) Int '[]
+type E2 = Int ':- Bool
+type F2 = '(:-) Int Bool
+
+-- non-promoted datacons
+-- (no warnings)
+data G = GA | GB
+a3, b3, c3 :: [G]
+a3 = GA : []
+b3 = [GA, GB]
+c3 = (:) GA []
+
+e3, f3 :: D G
+e3 = GA :- GB
+f3 = (:-) GA GB