[Git][ghc/ghc][wip/T18462] Check that mult ann affects constructor type

Sjoerd Visscher (@trac-sjoerd_visscher) gitlab at gitlab.haskell.org
Thu Oct 31 15:18:59 UTC 2024



Sjoerd Visscher pushed to branch wip/T18462 at Glasgow Haskell Compiler / GHC


Commits:
ad34a8de by Sjoerd Visscher at 2024-10-31T16:18:52+01:00
Check that mult ann affects constructor type

- - - - -


3 changed files:

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


Changes:

=====================================
testsuite/tests/linear/should_fail/LinearRecFieldMany.hs
=====================================
@@ -0,0 +1,9 @@
+{-# LANGUAGE LinearTypes, DataKinds #-}
+module LinearRecFieldMany where
+
+import GHC.Exts (Multiplicity(..))
+
+data C = C { urC %'Many :: Int }
+
+test :: Int %1 -> C
+test = C


=====================================
testsuite/tests/linear/should_fail/LinearRecFieldMany.stderr
=====================================
@@ -0,0 +1,6 @@
+LinearRecFieldMany.hs:9:8: [GHC-83865]
+     Couldn't match type ‘Many’ with ‘One’
+      Expected: Int %1 -> C
+        Actual: Int -> C
+     In the expression: C
+      In an equation for ‘test’: test = C


=====================================
testsuite/tests/linear/should_fail/all.T
=====================================
@@ -34,6 +34,7 @@ test('LinearFFI', normal, compile_fail, [''])
 test('LinearTHFail', normal, compile_fail, [''])
 test('LinearTHFail2', normal, compile_fail, [''])
 test('LinearTHFail3', normal, compile_fail, [''])
+test('LinearRecFieldMany', normal, compile_fail, [''])
 test('T18888', normal, compile_fail, [''])
 test('T18888_datakinds', normal, compile_fail, [''])
 test('T19120', normal, compile_fail, [''])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ad34a8dea4f6bad914050302eddb598a37abac5c
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/20241031/a2523acb/attachment-0001.html>


More information about the ghc-commits mailing list