summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-02-19 19:43:30 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-27 19:05:54 -0500
commitb8d40af138fe0f7fad9b6afafe2152d8213a3e25 (patch)
treee56767989a08f32b13267d789b90349759d5c649 /testsuite
parent382cd3b0c0a69d8e85e1588dc69b743c4a721818 (diff)
downloadhaskell-b8d40af138fe0f7fad9b6afafe2152d8213a3e25.tar.gz
Fix assertion error with linear types, #19400
The previous code using TyCoMapper could promote the same metavar twice. Use a set instead.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/linear/should_compile/T19400.hs14
-rw-r--r--testsuite/tests/linear/should_compile/all.T1
2 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_compile/T19400.hs b/testsuite/tests/linear/should_compile/T19400.hs
new file mode 100644
index 0000000000..360c2358a2
--- /dev/null
+++ b/testsuite/tests/linear/should_compile/T19400.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE ExistentialQuantification, LambdaCase, LinearTypes #-}
+
+module T19400 where
+
+data Stream = forall s. Stream (Either s s)
+
+f :: x %m -> y %m -> Int
+f x y = f x y
+
+step' :: () -> Stream -> Int
+step' x (Stream s) =
+ (\case
+ Left y -> f x y
+ Right y -> f x y) s
diff --git a/testsuite/tests/linear/should_compile/all.T b/testsuite/tests/linear/should_compile/all.T
index cea6db8d73..fd44aef367 100644
--- a/testsuite/tests/linear/should_compile/all.T
+++ b/testsuite/tests/linear/should_compile/all.T
@@ -36,3 +36,4 @@ test('LinearTH2', normal, compile, [''])
test('LinearTH3', normal, compile, [''])
test('LinearHole', normal, compile, [''])
test('T18731', normal, compile, [''])
+test('T19400', unless(compiler_debugged(), skip), compile, [''])