[Git][ghc/ghc][master] Add tests for #23883

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Dec 30 16:53:46 UTC 2024



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


Commits:
559d4f84 by Krzysztof Gogolewski at 2024-12-30T11:53:19-05:00
Add tests for #23883

The issue has been fixed by commit f5d3e03c56ffc63.
Only T23883a is the actual regression test, the remaining ones are
tricky cases found during development of an independent fix !11313.

- - - - -


8 changed files:

- + testsuite/tests/rep-poly/T23153b.hs
- + testsuite/tests/rep-poly/T23883a.hs
- + testsuite/tests/rep-poly/T23883a.stderr
- + testsuite/tests/rep-poly/T23883b.hs
- + testsuite/tests/rep-poly/T23883b.stderr
- + testsuite/tests/rep-poly/T23883c.hs
- + testsuite/tests/rep-poly/T23883c.stderr
- testsuite/tests/rep-poly/all.T


Changes:

=====================================
testsuite/tests/rep-poly/T23153b.hs
=====================================
@@ -0,0 +1,8 @@
+module T23153b where
+
+import GHC.Exts
+
+f :: forall r s (a :: TYPE (r s)). a -> a
+f = f
+
+g h = case f (h ()) of () -> ()


=====================================
testsuite/tests/rep-poly/T23883a.hs
=====================================
@@ -0,0 +1,6 @@
+module T23883a where
+
+import GHC.Exts
+
+setField :: forall a_rep (a :: TYPE a_rep). a -> Int
+setField x = undefined (\ _ -> x)


=====================================
testsuite/tests/rep-poly/T23883a.stderr
=====================================
@@ -0,0 +1,6 @@
+T23883a.hs:6:1: error: [GHC-55287]
+    The first pattern in the equation for ‘setField’
+    does not have a fixed runtime representation.
+    Its type is:
+      a :: TYPE a_rep
+


=====================================
testsuite/tests/rep-poly/T23883b.hs
=====================================
@@ -0,0 +1,6 @@
+module T23883b where
+
+import GHC.Exts
+
+setField :: forall a_rep (a :: TYPE a_rep). a -> ()
+setField x _ = ()


=====================================
testsuite/tests/rep-poly/T23883b.stderr
=====================================
@@ -0,0 +1,5 @@
+T23883b.hs:6:1: error: [GHC-83865]
+    • Couldn't match expected type ‘()’ with actual type ‘t0 -> ()’
+    • The equation for ‘setField’ has two visible arguments,
+        but its type ‘a -> ()’ has only one
+


=====================================
testsuite/tests/rep-poly/T23883c.hs
=====================================
@@ -0,0 +1,6 @@
+module T23883c where
+
+import GHC.Exts
+
+setField :: forall r s (a :: TYPE (r s)). a -> ()
+setField x _ = ()


=====================================
testsuite/tests/rep-poly/T23883c.stderr
=====================================
@@ -0,0 +1,5 @@
+T23883c.hs:6:1: error: [GHC-83865]
+    • Couldn't match expected type ‘()’ with actual type ‘t0 -> ()’
+    • The equation for ‘setField’ has two visible arguments,
+        but its type ‘a -> ()’ has only one
+


=====================================
testsuite/tests/rep-poly/all.T
=====================================
@@ -34,8 +34,12 @@ test('T22291', normal, compile, [''])
 test('T22291b', normal, compile, [''])
 test('T23051', normal, compile_fail, [''])
 test('T23153', normal, compile_fail, [''])
+test('T23153b', normal, compile, [''])
 test('T23154', normal, compile_fail, [''])
 test('T23176', normal, compile_fail, ['-XPartialTypeSignatures -fdefer-out-of-scope-variables'])
+test('T23883a', normal, compile_fail, [''])
+test('T23883b', normal, compile_fail, [''])
+test('T23883c', normal, compile_fail, [''])
 test('T23903', normal, compile_fail, [''])
 
 test('EtaExpandDataCon', normal, compile, ['-O'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/559d4f846fb13cb0cb181c7882b9128e1d2bfdf4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/559d4f846fb13cb0cb181c7882b9128e1d2bfdf4
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/20241230/24e848f7/attachment-0001.html>


More information about the ghc-commits mailing list