diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2020-10-28 23:09:48 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-03 17:41:10 -0500 |
commit | 616bec0dee67ae4841c4e60e9406cc9c63358223 (patch) | |
tree | 699bfab7a19b5a8409394ab5ddaab729e115d496 /testsuite | |
parent | 14ce454f7294381225b4211dc191a167a386e380 (diff) | |
download | haskell-616bec0dee67ae4841c4e60e9406cc9c63358223.tar.gz |
Restrict Linear arrow %1 to exactly literal 1 only
This disallows `a %001 -> b`, and makes sure the type literal is
printed from its SourceText so it is clear why.
Closes #18888
Diffstat (limited to 'testsuite')
5 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_fail/T18888.hs b/testsuite/tests/linear/should_fail/T18888.hs new file mode 100644 index 0000000000..870c993cdb --- /dev/null +++ b/testsuite/tests/linear/should_fail/T18888.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE LinearTypes #-} +module T18888 where + +f :: a %001 -> b +f x = undefined x diff --git a/testsuite/tests/linear/should_fail/T18888.stderr b/testsuite/tests/linear/should_fail/T18888.stderr new file mode 100644 index 0000000000..c224a5b331 --- /dev/null +++ b/testsuite/tests/linear/should_fail/T18888.stderr @@ -0,0 +1,3 @@ + +T18888.hs:4:9: + Illegal type: ‘001’ Perhaps you intended to use DataKinds diff --git a/testsuite/tests/linear/should_fail/T18888_datakinds.hs b/testsuite/tests/linear/should_fail/T18888_datakinds.hs new file mode 100644 index 0000000000..8b4bd18247 --- /dev/null +++ b/testsuite/tests/linear/should_fail/T18888_datakinds.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE LinearTypes #-} +{-# LANGUAGE DataKinds #-} +module T18888 where + +f :: a %001 -> b +f x = undefined x diff --git a/testsuite/tests/linear/should_fail/T18888_datakinds.stderr b/testsuite/tests/linear/should_fail/T18888_datakinds.stderr new file mode 100644 index 0000000000..a2a7ad88c7 --- /dev/null +++ b/testsuite/tests/linear/should_fail/T18888_datakinds.stderr @@ -0,0 +1,5 @@ + +T18888_datakinds.hs:5:9: + Expected kind ‘GHC.Types.Multiplicity’, + but ‘001’ has kind ‘GHC.Num.Natural.Natural’ + In the type signature: f :: a %001 -> b diff --git a/testsuite/tests/linear/should_fail/all.T b/testsuite/tests/linear/should_fail/all.T index 95cb337711..60bf3c4337 100644 --- a/testsuite/tests/linear/should_fail/all.T +++ b/testsuite/tests/linear/should_fail/all.T @@ -32,3 +32,5 @@ test('LinearIf', normal, compile_fail, ['']) test('LinearPatternGuardWildcard', normal, compile_fail, ['']) test('LinearFFI', normal, compile_fail, ['']) test('LinearTHFail', normal, compile_fail, ['']) +test('T18888', normal, compile_fail, ['']) +test('T18888_datakinds', normal, compile_fail, ['']) |