Test #6147, which was fixed with the roles commit.
authorRichard Eisenberg <eir@cis.upenn.edu>
Sun, 9 Feb 2014 16:25:42 +0000 (11:25 -0500)
committerRichard Eisenberg <eir@cis.upenn.edu>
Sun, 9 Feb 2014 16:25:42 +0000 (11:25 -0500)
testsuite/tests/deriving/should_fail/T6147.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T6147.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_fail/all.T

diff --git a/testsuite/tests/deriving/should_fail/T6147.hs b/testsuite/tests/deriving/should_fail/T6147.hs
new file mode 100644 (file)
index 0000000..f57f5af
--- /dev/null
@@ -0,0 +1,13 @@
+{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies #-}
+module T6147 where
+
+data family T a
+data instance T Int = T_Int Int
+
+class C a where
+  foo :: a -> T a
+
+instance C Int where
+  foo = T_Int
+
+newtype Foo = Foo Int deriving(C)
diff --git a/testsuite/tests/deriving/should_fail/T6147.stderr b/testsuite/tests/deriving/should_fail/T6147.stderr
new file mode 100644 (file)
index 0000000..ffe584c
--- /dev/null
@@ -0,0 +1,11 @@
+
+T6147.hs:13:32:
+    Could not coerce from ‛T Int’ to ‛T Foo’
+      because the first type argument of ‛T’ has role Nominal,
+      but the arguments ‛Int’ and ‛Foo’ differ
+      arising from the coercion of the method ‛foo’ from type
+                   ‛Int -> T Int’ to type ‛Foo -> T Foo’
+    Possible fix:
+      use a standalone 'deriving instance' declaration,
+        so you can specify the instance context yourself
+    When deriving the instance for (C Foo)
index b2b99ff..1ffa5fc 100644 (file)
@@ -48,3 +48,4 @@ test('T7148', normal, compile_fail, [''])
 test('T7148a', normal, compile_fail, [''])
 test('T7800', normal, multimod_compile_fail, ['T7800',''])
 test('T5498', normal, compile_fail, [''])
+test('T6147', normal, compile_fail, [''])
\ No newline at end of file