[Git][ghc/ghc][master] Add a test for #21278

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu May 11 15:56:19 UTC 2023



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


Commits:
ad16a066 by Krzysztof Gogolewski at 2023-05-11T11:55:59-04:00
Add a test for #21278

- - - - -


3 changed files:

- + testsuite/tests/linear/should_fail/T21278.hs
- + testsuite/tests/linear/should_fail/T21278.stderr
- testsuite/tests/linear/should_fail/all.T


Changes:

=====================================
testsuite/tests/linear/should_fail/T21278.hs
=====================================
@@ -0,0 +1,7 @@
+{-# LANGUAGE LinearTypes #-}
+module T21278 where
+
+data C a = forall p. C (a %p -> a)
+
+f :: C a -> C a
+f b = C (\x -> case b of C g -> g x)


=====================================
testsuite/tests/linear/should_fail/T21278.stderr
=====================================
@@ -0,0 +1,13 @@
+
+T21278.hs:7:11: error: [GHC-25897]
+    • Couldn't match type ‘p’ with ‘Many’
+        arising from multiplicity of ‘x’
+      ‘p’ is a rigid type variable bound by
+        a pattern with constructor:
+          C :: forall a (p :: GHC.Types.Multiplicity). (a %p -> a) %1 -> C a,
+        in a case alternative
+        at T21278.hs:7:26-28
+    • In the first argument of ‘C’, namely
+        ‘(\ x -> case b of C g -> g x)’
+      In the expression: C (\ x -> case b of C g -> g x)
+      In an equation for ‘f’: f b = C (\ x -> case b of C g -> g x)


=====================================
testsuite/tests/linear/should_fail/all.T
=====================================
@@ -40,3 +40,4 @@ test('T18888_datakinds', normal, compile_fail, [''])
 test('T19120', normal, compile_fail, [''])
 test('T20083', normal, compile_fail, ['-XLinearTypes'])
 test('T19361', normal, compile_fail, [''])
+test('T21278', normal, compile_fail, ['-XLinearTypes'])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ad16a0666340723b656879f4c0bb94653363608b
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/20230511/71debff8/attachment-0001.html>


More information about the ghc-commits mailing list