summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2023-04-17 10:31:32 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-05-09 18:40:38 -0400
commit6738c01d6175c5701e5c53e2ae6716d1103f7355 (patch)
treec9ed0945b17df4287f16612cfea64eafe802ed1c /testsuite
parent64064cfee57161bb42ef5c17bbe434185893ee5f (diff)
downloadhaskell-6738c01d6175c5701e5c53e2ae6716d1103f7355.tar.gz
Add a regression test for #21050
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/th/T21050.hs11
-rw-r--r--testsuite/tests/th/T21050.stderr26
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/tests/th/T21050.hs b/testsuite/tests/th/T21050.hs
new file mode 100644
index 0000000000..6c31b7a3f4
--- /dev/null
+++ b/testsuite/tests/th/T21050.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TemplateHaskell, ImpredicativeTypes #-}
+module T21050 where
+
+import Language.Haskell.TH.Syntax
+
+data T = MkT (forall a. a)
+
+f x = [|| MkT $$(x) ||]
+
+g :: Code Q (forall a. a) -> Code Q T
+g x = [|| MkT $$(x) ||]
diff --git a/testsuite/tests/th/T21050.stderr b/testsuite/tests/th/T21050.stderr
new file mode 100644
index 0000000000..4d2a84e274
--- /dev/null
+++ b/testsuite/tests/th/T21050.stderr
@@ -0,0 +1,26 @@
+
+T21050.hs:8:18: error: [GHC-25897]
+ • Couldn't match expected type ‘Code m a1’ with actual type ‘p’
+ ‘p’ is a rigid type variable bound by
+ the inferred type of f :: Quote m => p -> Code m T
+ at T21050.hs:8:1-23
+ • In the expression: x
+ In the Template Haskell splice $$(x)
+ In the first argument of ‘MkT’, namely ‘$$(x)’
+ • Relevant bindings include
+ x :: p (bound at T21050.hs:8:3)
+ f :: p -> Code m T (bound at T21050.hs:8:1)
+
+T21050.hs:11:18: error: [GHC-91028]
+ • Couldn't match type ‘a’ with ‘forall a2. a2’
+ Expected: Code Q a
+ Actual: Code Q (forall a. a)
+ Cannot equate type variable ‘a’
+ with a type involving polytypes: forall a2. a2
+ ‘a’ is a rigid type variable bound by
+ a type expected by the context:
+ forall a. a
+ at T21050.hs:11:15-19
+ • In the expression: x
+ In the Template Haskell splice $$(x)
+ In the first argument of ‘MkT’, namely ‘$$(x)’
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 60f02a9c2e..3a98df38ee 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -564,3 +564,4 @@ test('TH_typed2', normal, compile_and_run, [''])
test('TH_typed3', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('TH_typed4', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('TH_typed5', normal, compile_and_run, [''])
+test('T21050', normal, compile_fail, [''])