summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-12-18 11:19:14 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-12-18 11:19:52 +0000
commit6ec9e958d6a6693dedbcbfc74f164d38e5fb5381 (patch)
treef9263a192d115fceaa28ea093a9002d90bc5145b
parent726ea08a6e5899ccefe9b9bd65738141f257fc13 (diff)
downloadhaskell-6ec9e958d6a6693dedbcbfc74f164d38e5fb5381.tar.gz
Fix wrong-kind-of-family error message (Trac #9896)
-rw-r--r--compiler/typecheck/TcTyClsDecls.hs4
-rw-r--r--testsuite/tests/indexed-types/should_fail/SimpleFail3a.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T9896.hs8
-rw-r--r--testsuite/tests/indexed-types/should_fail/T9896.stderr5
-rw-r--r--testsuite/tests/indexed-types/should_fail/all.T1
-rw-r--r--testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr10
6 files changed, 22 insertions, 8 deletions
diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs
index 595e853037..6545e7b8e2 100644
--- a/compiler/typecheck/TcTyClsDecls.hs
+++ b/compiler/typecheck/TcTyClsDecls.hs
@@ -2223,8 +2223,8 @@ wrongKindOfFamily family
= ptext (sLit "Wrong category of family instance; declaration was for a")
<+> kindOfFamily
where
- kindOfFamily | isTypeSynonymTyCon family = text "type synonym"
- | isAlgTyCon family = text "data type"
+ kindOfFamily | isTypeFamilyTyCon family = text "type family"
+ | isDataFamilyTyCon family = text "data family"
| otherwise = pprPanic "wrongKindOfFamily" (ppr family)
wrongNumberOfParmsErr :: Arity -> SDoc
diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail3a.stderr b/testsuite/tests/indexed-types/should_fail/SimpleFail3a.stderr
index 7db6f3b91a..795188e922 100644
--- a/testsuite/tests/indexed-types/should_fail/SimpleFail3a.stderr
+++ b/testsuite/tests/indexed-types/should_fail/SimpleFail3a.stderr
@@ -1,5 +1,5 @@
SimpleFail3a.hs:10:3:
- Wrong category of family instance; declaration was for a data type
+ Wrong category of family instance; declaration was for a data family
In the type instance declaration for ‘S1’
In the instance declaration for ‘C1 Int’
diff --git a/testsuite/tests/indexed-types/should_fail/T9896.hs b/testsuite/tests/indexed-types/should_fail/T9896.hs
new file mode 100644
index 0000000000..ca5238e22f
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T9896.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE TypeFamilies #-}
+module T9896 where
+
+class Test a where
+ type TestT a :: *
+
+instance Test Bool where
+ newtype TestT Bool = Int
diff --git a/testsuite/tests/indexed-types/should_fail/T9896.stderr b/testsuite/tests/indexed-types/should_fail/T9896.stderr
new file mode 100644
index 0000000000..f46e406f03
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T9896.stderr
@@ -0,0 +1,5 @@
+
+T9896.hs:8:3:
+ Wrong category of family instance; declaration was for a type family
+ In the newtype instance declaration for ‘TestT’
+ In the instance declaration for ‘Test Bool’
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T
index 93085af239..821342cdfa 100644
--- a/testsuite/tests/indexed-types/should_fail/all.T
+++ b/testsuite/tests/indexed-types/should_fail/all.T
@@ -131,3 +131,4 @@ test('BadSock', normal, compile_fail, [''])
test('T9580', normal, multimod_compile_fail, ['T9580', ''])
test('T9662', normal, compile_fail, [''])
test('T7862', normal, compile_fail, [''])
+test('T9896', normal, compile_fail, [''])
diff --git a/testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr b/testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr
index c0950bcc74..0f0c951a1d 100644
--- a/testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr
+++ b/testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr
@@ -1,5 +1,5 @@
-
-AssocTyDef03.hs:6:5:
- Wrong category of family instance; declaration was for a data type
- In the default type instance declaration for ‘Typ’
- In the class declaration for ‘Cls’
+
+AssocTyDef03.hs:6:5:
+ Wrong category of family instance; declaration was for a data family
+ In the default type instance declaration for ‘Typ’
+ In the class declaration for ‘Cls’