diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
19 files changed, 115 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef01.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef01.hs new file mode 100644 index 0000000000..f3b0d3b43f --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef01.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef01 where + +class OtherCls a where + type OtherTyp a + +class Cls a where + type Typ a + type OtherType a = Int + -- Default for another class AT: want error diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef01.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef01.stderr new file mode 100644 index 0000000000..5d3a596d97 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef01.stderr @@ -0,0 +1,3 @@ + +AssocTyDef01.hs:9:10: + `OtherType' is not a (visible) associated type of class `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef02.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef02.hs new file mode 100644 index 0000000000..8f22d4ce1c --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef02.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef02 where + +class Cls a where + type Typ a + type Typ b = Int + -- Default is not parametric in type class params diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef02.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef02.stderr new file mode 100644 index 0000000000..9facede780 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef02.stderr @@ -0,0 +1,6 @@ + +AssocTyDef02.hs:6:5: + Type indexes must match class instance head + Found `b' but expected `a' + In the type synonym instance declaration for `Typ' + In the class declaration for `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef03.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef03.hs new file mode 100644 index 0000000000..790f2740ee --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef03.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef03 where + +class Cls a where + data Typ a + type Typ a = Int + -- Default for data family :-(
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr new file mode 100644 index 0000000000..2572980161 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr @@ -0,0 +1,5 @@ + +AssocTyDef03.hs:6:5: + Wrong category of family instance; declaration was for a data type + In the type synonym instance declaration for `Typ' + In the class declaration for `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef04.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef04.hs new file mode 100644 index 0000000000..2ff833725e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef04.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef04 where + +class Cls a where + type Typ a + type Typ a = Maybe + -- Wrong kind for default
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef04.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef04.stderr new file mode 100644 index 0000000000..5eb90241a5 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef04.stderr @@ -0,0 +1,7 @@ + +AssocTyDef04.hs:6:18: + `Maybe' is not applied to enough type arguments + Expected kind `*', but `Maybe' has kind `* -> *' + In the type `Maybe' + In the type synonym instance declaration for `Typ' + In the class declaration for `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef05.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef05.hs new file mode 100644 index 0000000000..097d14f40a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef05.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef05 where + +class Cls a where + type Typ a + type Typ = Maybe + -- Too few params for default
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef05.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef05.stderr new file mode 100644 index 0000000000..0518c84b69 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef05.stderr @@ -0,0 +1,5 @@ + +AssocTyDef05.hs:6:5: + Number of parameters must match family declaration; expected 1 + In the type synonym instance declaration for `Typ' + In the class declaration for `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef06.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef06.hs new file mode 100644 index 0000000000..fb595a3e27 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef06.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef06 where + +class Cls a where + type Typ a + type Typ a Int = Int + -- Too many params for default
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef06.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef06.stderr new file mode 100644 index 0000000000..7c79207a49 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef06.stderr @@ -0,0 +1,5 @@ + +AssocTyDef06.hs:6:5: + Family instance has too many parameters: `Typ' + In the type synonym instance declaration for `Typ' + In the class declaration for `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef07.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef07.hs new file mode 100644 index 0000000000..65c7f5f3f5 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef07.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef07 where + +class Cls a where + type Typ a = Int + -- Default without family diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef07.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef07.stderr new file mode 100644 index 0000000000..4a4562d0e0 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef07.stderr @@ -0,0 +1,3 @@ + +AssocTyDef07.hs:5:10: + `Typ' is not a (visible) associated type of class `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef08.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef08.hs new file mode 100644 index 0000000000..6a7d808bb7 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef08.hs @@ -0,0 +1,5 @@ +module AssocTyDef07 where + +class Cls a where + type Typ a = Int + -- Default without family OR extension flag diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef08.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef08.stderr new file mode 100644 index 0000000000..c45132f994 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef08.stderr @@ -0,0 +1,3 @@ + +AssocTyDef08.hs:4:10: + `Typ' is not a (visible) associated type of class `Cls' diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef09.hs b/testsuite/tests/typecheck/should_fail/AssocTyDef09.hs new file mode 100644 index 0000000000..085cbb5bb3 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef09.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeFamilies #-} +module AssocTyDef01 where + +type family OtherTyp a + +class Cls a where + type Typ a + type OtherType a = Int + -- Default for top level AT: want error diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef09.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef09.stderr new file mode 100644 index 0000000000..053450c48e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/AssocTyDef09.stderr @@ -0,0 +1,3 @@ + +AssocTyDef09.hs:8:10: + `OtherType' is not a (visible) associated type of class `Cls' diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 0788788e89..cc88208512 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -245,3 +245,13 @@ test('T5246',normal,compile_fail,['']) test('T5300',normal,compile_fail,['']) test('T5095',normal,compile_fail,['']) test('T1897a',normal,compile_fail,['']) + +test('AssocTyDef01', normal, compile_fail, ['']) +test('AssocTyDef02', normal, compile_fail, ['']) +test('AssocTyDef03', normal, compile_fail, ['']) +test('AssocTyDef04', normal, compile_fail, ['']) +test('AssocTyDef05', normal, compile_fail, ['']) +test('AssocTyDef06', normal, compile_fail, ['']) +test('AssocTyDef07', normal, compile_fail, ['']) +test('AssocTyDef08', normal, compile_fail, ['']) +test('AssocTyDef09', normal, compile_fail, ['']) |