[commit: ghc] master: Fix wrong-kind-of-family error message (Trac #9896) (6ec9e95)

git at git.haskell.org git at git.haskell.org
Thu Dec 18 11:19:03 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6ec9e958d6a6693dedbcbfc74f164d38e5fb5381/ghc

>---------------------------------------------------------------

commit 6ec9e958d6a6693dedbcbfc74f164d38e5fb5381
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Dec 18 11:19:14 2014 +0000

    Fix wrong-kind-of-family error message (Trac #9896)


>---------------------------------------------------------------

6ec9e958d6a6693dedbcbfc74f164d38e5fb5381
 compiler/typecheck/TcTyClsDecls.hs                            | 4 ++--
 testsuite/tests/indexed-types/should_fail/SimpleFail3a.stderr | 2 +-
 testsuite/tests/indexed-types/should_fail/T9896.hs            | 8 ++++++++
 testsuite/tests/indexed-types/should_fail/T9896.stderr        | 5 +++++
 testsuite/tests/indexed-types/should_fail/all.T               | 1 +
 testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr     | 2 +-
 6 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs
index 595e853..6545e7b 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 7db6f3b..795188e 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 0000000..ca5238e
--- /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 0000000..f46e406
--- /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 93085af..821342c 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 c0950bc..0f0c951 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
+    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’



More information about the ghc-commits mailing list