[Git][ghc/ghc][master] Add a regression test for #21050

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue May 9 22:40:53 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
6738c01d by Krzysztof Gogolewski at 2023-05-09T18:40:38-04:00
Add a regression test for #21050

- - - - -


3 changed files:

- + testsuite/tests/th/T21050.hs
- + testsuite/tests/th/T21050.stderr
- testsuite/tests/th/all.T


Changes:

=====================================
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) ||]


=====================================
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)’


=====================================
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, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6738c01d6175c5701e5c53e2ae6716d1103f7355

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6738c01d6175c5701e5c53e2ae6716d1103f7355
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230509/91982d03/attachment-0001.html>


More information about the ghc-commits mailing list