diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2020-10-01 20:19:35 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-02 13:53:23 -0400 |
commit | 1033a720abf4a23a30c5cb0dfcb18b2bae3acc68 (patch) | |
tree | dc5c34a3cac1008905895e91274c556ed7acdc04 /testsuite | |
parent | 8dd4f40512bb18e296280acde0507b4233a27b69 (diff) | |
download | haskell-1033a720abf4a23a30c5cb0dfcb18b2bae3acc68.tar.gz |
Reject linearity in kinds in checkValidType (#18780)
Patch taken from https://gitlab.haskell.org/ghc/ghc/-/issues/18624#note_300673
Diffstat (limited to 'testsuite')
6 files changed, 29 insertions, 4 deletions
diff --git a/testsuite/tests/linear/should_fail/LinearKind.stderr b/testsuite/tests/linear/should_fail/LinearKind.stderr index 9ba3f744cf..c70e90a1b5 100644 --- a/testsuite/tests/linear/should_fail/LinearKind.stderr +++ b/testsuite/tests/linear/should_fail/LinearKind.stderr @@ -1,5 +1,4 @@ -LinearKind.hs:4:11: error: - • Linear arrows disallowed in kinds: * %1 -> * - • In the kind ‘* %1 -> *’ - In the data type declaration for ‘A’ +LinearKind.hs:4:1: error: + • Illegal linear function in a kind: * %1 -> * + • In the data type declaration for ‘A’ diff --git a/testsuite/tests/linear/should_fail/LinearKind2.hs b/testsuite/tests/linear/should_fail/LinearKind2.hs new file mode 100644 index 0000000000..402b67efc4 --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearKind2.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE LinearTypes, KindSignatures, DataKinds #-} +module LinearKind2 where -- T18780 + +import GHC.Exts +import GHC.Types + +data Two :: FUN One Type Type diff --git a/testsuite/tests/linear/should_fail/LinearKind2.stderr b/testsuite/tests/linear/should_fail/LinearKind2.stderr new file mode 100644 index 0000000000..0bdf1b0d19 --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearKind2.stderr @@ -0,0 +1,4 @@ + +LinearKind2.hs:7:1: error: + • Illegal linear function in a kind: * %1 -> * + • In the data type declaration for ‘Two’ diff --git a/testsuite/tests/linear/should_fail/LinearKind3.hs b/testsuite/tests/linear/should_fail/LinearKind3.hs new file mode 100644 index 0000000000..7d85cb6e96 --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearKind3.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE LinearTypes, KindSignatures, DataKinds #-} +module LinearKind3 where -- T18780 + +import GHC.Exts +import GHC.Types + +type K = Type %1 -> Type +data T :: K diff --git a/testsuite/tests/linear/should_fail/LinearKind3.stderr b/testsuite/tests/linear/should_fail/LinearKind3.stderr new file mode 100644 index 0000000000..8e16996baf --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearKind3.stderr @@ -0,0 +1,5 @@ + +LinearKind3.hs:8:1: error: + • Illegal linear function in a kind: * %1 -> * + • In the expansion of type synonym ‘K’ + In the data type declaration for ‘T’ diff --git a/testsuite/tests/linear/should_fail/all.T b/testsuite/tests/linear/should_fail/all.T index bcba344268..272e9e2a35 100644 --- a/testsuite/tests/linear/should_fail/all.T +++ b/testsuite/tests/linear/should_fail/all.T @@ -20,6 +20,8 @@ test('LinearPatSyn', normal, compile_fail, ['']) test('LinearGADTNewtype', normal, compile_fail, ['']) test('LinearPartialSig', normal, compile_fail, ['']) test('LinearKind', normal, compile_fail, ['']) +test('LinearKind2', normal, compile_fail, ['']) +test('LinearKind3', normal, compile_fail, ['']) test('LinearVar', normal, compile_fail, ['-XLinearTypes']) test('LinearErrOrigin', normal, compile_fail, ['-XLinearTypes']) test('LinearPolyType', normal, compile_fail, ['']) # not supported yet (#390) |