diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2014-02-09 11:25:42 -0500 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2014-02-09 11:25:42 -0500 |
commit | 9e0c1ae57526bacaca044a7ce5a6491fb6a7cb42 (patch) | |
tree | 6abdfbd98d94ff0dba82a316fc9d81ddbd47f08f /testsuite/tests/deriving | |
parent | 8cc398ff8b3f7408327d99347f440693cb204c0a (diff) | |
download | haskell-9e0c1ae57526bacaca044a7ce5a6491fb6a7cb42.tar.gz |
Test #6147, which was fixed with the roles commit.
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r-- | testsuite/tests/deriving/should_fail/T6147.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_fail/T6147.stderr | 11 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_fail/all.T | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_fail/T6147.hs b/testsuite/tests/deriving/should_fail/T6147.hs new file mode 100644 index 0000000000..f57f5af4de --- /dev/null +++ b/testsuite/tests/deriving/should_fail/T6147.hs @@ -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 index 0000000000..ffe584c1de --- /dev/null +++ b/testsuite/tests/deriving/should_fail/T6147.stderr @@ -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) diff --git a/testsuite/tests/deriving/should_fail/all.T b/testsuite/tests/deriving/should_fail/all.T index b2b99ff997..1ffa5fc466 100644 --- a/testsuite/tests/deriving/should_fail/all.T +++ b/testsuite/tests/deriving/should_fail/all.T @@ -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 |