summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-12-01 18:59:36 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-02 19:47:18 -0500
commit108c319f47e31fb307d7aff718b40578c8026ddd (patch)
treed9cf271f338018bae63f55ead50d500474a0c2cc /testsuite
parent85ecc1a0fd6536149ae2b54f4b1985d80c0e21cb (diff)
downloadhaskell-108c319f47e31fb307d7aff718b40578c8026ddd.tar.gz
Fix linearity checking in Lint
Lint was not able to see that x*y <= x*y, because this inequality was decomposed to x <= x*y && y <= x*y, but there was no rule to see that x <= x*y. Fixes #22546.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/linear/should_compile/T22546.hs12
-rw-r--r--testsuite/tests/linear/should_compile/all.T1
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_compile/T22546.hs b/testsuite/tests/linear/should_compile/T22546.hs
new file mode 100644
index 0000000000..c1b2041519
--- /dev/null
+++ b/testsuite/tests/linear/should_compile/T22546.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE LinearTypes, GADTSyntax #-}
+
+module T22546 where
+
+import GHC.Types (Multiplicity (..))
+import Data.Kind (Type)
+
+data T :: Multiplicity -> Type where
+ MkT :: () %m-> T m
+
+unMkT :: T m %n-> ()
+unMkT (MkT x) = x
diff --git a/testsuite/tests/linear/should_compile/all.T b/testsuite/tests/linear/should_compile/all.T
index 3b73636071..d0f16080d8 100644
--- a/testsuite/tests/linear/should_compile/all.T
+++ b/testsuite/tests/linear/should_compile/all.T
@@ -39,3 +39,4 @@ test('LinearDataConSections', normal, compile, [''])
test('T18731', normal, compile, [''])
test('T19400', unless(compiler_debugged(), skip), compile, [''])
test('T20023', normal, compile, [''])
+test('T22546', normal, compile, [''])