diff options
author | Thomas Winant <thomas.winant@cs.kuleuven.be> | 2015-01-12 05:29:50 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-01-13 10:10:38 -0600 |
commit | c9532f810a82c6395bc08fb77f2a895a50da86b5 (patch) | |
tree | 74fc215f8f41744670719cdeeb7cbd7f530b619d /testsuite/tests/partial-sigs | |
parent | 7637810a93441d29bc84bbeeeced0615bbb9d9e4 (diff) | |
download | haskell-c9532f810a82c6395bc08fb77f2a895a50da86b5.tar.gz |
Fix panics of PartialTypeSignatures combined with extensions
Summary:
Disallow wildcards in stand-alone deriving instances
(StandaloneDeriving), default signatures (DefaultSignatures) and
instances signatures (InstanceSigs).
Test Plan: validate
Reviewers: austin
Reviewed By: austin
Subscribers: carter, thomie, monoidal
Differential Revision: https://phabricator.haskell.org/D595
GHC Trac Issues: #9922
Diffstat (limited to 'testsuite/tests/partial-sigs')
7 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInDefaultSignature.hs b/testsuite/tests/partial-sigs/should_fail/WildcardInDefaultSignature.hs new file mode 100644 index 0000000000..5e85e59098 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInDefaultSignature.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE DefaultSignatures #-} +module WildcardInDefaultSignature where + +class C a where default f :: _ diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInDefaultSignature.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardInDefaultSignature.stderr new file mode 100644 index 0000000000..38cb4ce41a --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInDefaultSignature.stderr @@ -0,0 +1,4 @@ + +WildcardInDefaultSignature.hs:4:30: + Wildcard not allowed + in default signature: ‘_’ diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInInstanceSig.hs b/testsuite/tests/partial-sigs/should_fail/WildcardInInstanceSig.hs new file mode 100644 index 0000000000..cd36449a96 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInInstanceSig.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE InstanceSigs #-} +module WildcardInInstanceSig where + +instance Num Bool where negate :: _ diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInInstanceSig.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardInInstanceSig.stderr new file mode 100644 index 0000000000..e8148f1bb3 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInInstanceSig.stderr @@ -0,0 +1,4 @@ + +WildcardInInstanceSig.hs:4:35: + Wildcard not allowed + in instance signature: ‘negate :: _’ diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInStandaloneDeriving.hs b/testsuite/tests/partial-sigs/should_fail/WildcardInStandaloneDeriving.hs new file mode 100644 index 0000000000..63489219f6 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInStandaloneDeriving.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE StandaloneDeriving #-} +module WildcardInStandaloneDeriving where + +deriving instance _ diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInStandaloneDeriving.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardInStandaloneDeriving.stderr new file mode 100644 index 0000000000..921d7a0d34 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInStandaloneDeriving.stderr @@ -0,0 +1,4 @@ + +WildcardInStandaloneDeriving.hs:4:19: + Wildcard not allowed + in the stand-alone deriving instance: ‘_’ diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T index c275e93b7f..7e56d15c71 100644 --- a/testsuite/tests/partial-sigs/should_fail/all.T +++ b/testsuite/tests/partial-sigs/should_fail/all.T @@ -26,15 +26,18 @@ test('WildcardInADT3', normal, compile_fail, ['']) test('WildcardInADTContext1', normal, compile_fail, ['']) test('WildcardInADTContext2', normal, compile_fail, ['']) test('WildcardInDefault', normal, compile_fail, ['']) +test('WildcardInDefaultSignature', normal, compile_fail, ['']) test('WildcardInDeriving', normal, compile_fail, ['']) test('WildcardInForeignExport', normal, compile_fail, ['']) test('WildcardInForeignImport', normal, compile_fail, ['']) test('WildcardInGADT1', normal, compile_fail, ['']) test('WildcardInGADT2', normal, compile_fail, ['']) test('WildcardInInstanceHead', normal, compile_fail, ['']) +test('WildcardInInstanceSig', normal, compile_fail, ['']) test('WildcardsInPatternAndExprSig', normal, compile_fail, ['']) test('WildcardInPatSynSig', normal, compile_fail, ['']) test('WildcardInNewtype', normal, compile_fail, ['']) +test('WildcardInStandaloneDeriving', normal, compile_fail, ['']) test('WildcardInstantiations', normal, compile_fail, ['']) test('WildcardInTypeBrackets', [req_interp, only_compiler_types(['ghc'])], compile_fail, ['']) test('WildcardInTypeFamilyInstanceLHS', normal, compile_fail, ['']) |