diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2023-04-20 14:02:06 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2023-05-10 15:13:04 +0200 |
commit | 1d5e550f743855b3f458deffb7a1e7265808ad04 (patch) | |
tree | 4bdf4d8468df78b7fa9671d635cfac86332eefeb | |
parent | 0e2df4c9ac59a10080bd6e029e83a355ecd01c8b (diff) | |
download | haskell-wip/T21278.tar.gz |
Add a test for #21278wip/T21278
-rw-r--r-- | testsuite/tests/linear/should_fail/T21278.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/linear/should_fail/T21278.stderr | 13 | ||||
-rw-r--r-- | testsuite/tests/linear/should_fail/all.T | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_fail/T21278.hs b/testsuite/tests/linear/should_fail/T21278.hs new file mode 100644 index 0000000000..d256637b32 --- /dev/null +++ b/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) diff --git a/testsuite/tests/linear/should_fail/T21278.stderr b/testsuite/tests/linear/should_fail/T21278.stderr new file mode 100644 index 0000000000..951fa50a05 --- /dev/null +++ b/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) diff --git a/testsuite/tests/linear/should_fail/all.T b/testsuite/tests/linear/should_fail/all.T index 4d8eec398e..2d7c6ed509 100644 --- a/testsuite/tests/linear/should_fail/all.T +++ b/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']) |