summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorJakob Brünker <jakob.bruenker@gmail.com>2021-12-09 13:55:18 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-11 00:55:48 -0500
commit8d1f30e7cfa5b459aab9dcf3052f3f7f274666e3 (patch)
treeaef54cdd4b1ebf3b82512f573fdd01308efdc272 /testsuite/tests
parentb4a554197be38be72b4a52603efac84983a6b2bc (diff)
downloadhaskell-8d1f30e7cfa5b459aab9dcf3052f3f7f274666e3.tar.gz
Add PromotedInfixT/PromotedUInfixT to TH
Previously, it was not possible to refer to a data constructor using InfixT with a dynamically bound name (i.e. a name with NameFlavour `NameS` or `NameQ`) if a type constructor of the same name exists. This commit adds promoted counterparts to InfixT and UInfixT, analogously to how PromotedT is the promoted counterpart to ConT. Closes #20773
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/th/T20773.script17
-rw-r--r--testsuite/tests/th/T20773.stdout6
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/th/T20773.script b/testsuite/tests/th/T20773.script
new file mode 100644
index 0000000000..9b71d0926e
--- /dev/null
+++ b/testsuite/tests/th/T20773.script
@@ -0,0 +1,17 @@
+:seti -XDataKinds -XTemplateHaskell
+import Language.Haskell.TH
+import Data.Proxy
+
+data (:::) = forall k k' . k ::: k'; infixr 5 :::
+
+intT = ConT ''Int
+stringT = ConT ''String
+boolT = ConT ''Bool
+
+:t Proxy @($(pure $ UInfixT intT '(:::) stringT))
+
+promUInf x y = PromotedUInfixT x (mkName ":::") y
+:t Proxy @($(pure $ (intT `promUInf` stringT) `promUInf` boolT))
+
+promInf x y = PromotedInfixT x (mkName ":::") y
+:t Proxy @($(pure $ (intT `promInf` stringT) `promInf` boolT))
diff --git a/testsuite/tests/th/T20773.stdout b/testsuite/tests/th/T20773.stdout
new file mode 100644
index 0000000000..ea8c61726d
--- /dev/null
+++ b/testsuite/tests/th/T20773.stdout
@@ -0,0 +1,6 @@
+Proxy @($(pure $ UInfixT intT '(:::) stringT))
+ :: Proxy (Int '::: String)
+Proxy @($(pure $ (intT `promUInf` stringT) `promUInf` boolT))
+ :: Proxy (Int '::: (String '::: Bool))
+Proxy @($(pure $ (intT `promInf` stringT) `promInf` boolT))
+ :: Proxy ((Int '::: String) '::: Bool)
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 439e88cd9a..cfd40a40df 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -538,3 +538,4 @@ test('T17820c', normal, compile_fail, [''])
test('T17820d', normal, compile_fail, [''])
test('T17820e', normal, compile_fail, [''])
test('T20590', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
+test('T20773', only_ways(['ghci']), ghci_script, ['T20773.script'])