diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2015-09-19 14:32:44 -0400 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2015-09-21 10:53:39 -0400 |
commit | e27b267f3675180c03a75282dd952b8a59339a1f (patch) | |
tree | d4a47212e026a084f22b787b75ea9bef56f85dab /testsuite | |
parent | 2f9809efdbc11fee445dbe3d5c555433ec3c5e6a (diff) | |
download | haskell-e27b267f3675180c03a75282dd952b8a59339a1f.tar.gz |
Perform a validity check on assoc type defaults.
This fixes #10817 and #10899. A knock-on effect is that we must
now remember locations of associated type defaults for error
messages during validity checking. This isn't too bad, but it
increases the size of the diff somewhat.
Test cases: indexed-types/should_fail/T108{17,99}
Diffstat (limited to 'testsuite')
6 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T10817.hs b/testsuite/tests/indexed-types/should_fail/T10817.hs new file mode 100644 index 0000000000..a9a12d0daa --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T10817.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TypeFamilies #-} + +module T10817 where + +import Data.Proxy + +class C a where + type F a + type F a = F a + +instance C Bool + +x :: Proxy (F Bool) +x = Proxy diff --git a/testsuite/tests/indexed-types/should_fail/T10817.stderr b/testsuite/tests/indexed-types/should_fail/T10817.stderr new file mode 100644 index 0000000000..32c0e7f223 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T10817.stderr @@ -0,0 +1,6 @@ + +T10817.hs:9:3: error: + The type family application ‘F a’ + is no smaller than the instance head + (Use UndecidableInstances to permit this) + In the class declaration for ‘C’ diff --git a/testsuite/tests/indexed-types/should_fail/T10899.hs b/testsuite/tests/indexed-types/should_fail/T10899.hs new file mode 100644 index 0000000000..cacac4a2f7 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T10899.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies, RankNTypes #-} + +module T10899 where + +class C a where + type F a + type F a = forall m. m a diff --git a/testsuite/tests/indexed-types/should_fail/T10899.stderr b/testsuite/tests/indexed-types/should_fail/T10899.stderr new file mode 100644 index 0000000000..e48274c466 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T10899.stderr @@ -0,0 +1,4 @@ + +T10899.hs:7:3: error: + Illegal polymorphic or qualified type: forall (m :: * -> *). m a + In the class declaration for ‘C’ diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index a75dacd90e..722a4d3969 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -136,3 +136,5 @@ test('T7788', normal, compile_fail, ['']) test('T8550', normal, compile_fail, ['']) test('T9554', normal, compile_fail, ['']) test('T10141', normal, compile_fail, ['']) +test('T10817', normal, compile_fail, ['']) +test('T10899', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_compile/tc253.hs b/testsuite/tests/typecheck/should_compile/tc253.hs index 3ce439e4f2..2fd528b296 100644 --- a/testsuite/tests/typecheck/should_compile/tc253.hs +++ b/testsuite/tests/typecheck/should_compile/tc253.hs @@ -1,4 +1,6 @@ {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} + -- this is needed because |FamHelper a x| /< |Fam a x| module ShouldCompile where class Cls a where |