diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2013-11-19 12:01:27 +0000 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2013-11-19 12:01:27 +0000 |
commit | a37c6ad604e28c4f554e342ef8b967a2650829f9 (patch) | |
tree | d4eaa30a2db74cd2b2f1319f7093589f7b750523 /testsuite/tests/typecheck/should_fail | |
parent | 483ff505b7e1616680b8e8605292ae160a6ff77d (diff) | |
download | haskell-a37c6ad604e28c4f554e342ef8b967a2650829f9.tar.gz |
Test case for undersaturated newtype in Coercions
This is related to #8541.
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/TcCoercibleFail3.hs | 14 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr | 7 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.hs b/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.hs new file mode 100644 index 0000000000..4caf1c2632 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE RoleAnnotations, RankNTypes, ScopedTypeVariables #-} + +import GHC.Prim (coerce, Coercible) + +newtype List a = List [a] +data T f = T (f Int) + +newtype NT1 a = NT1 (a -> Int) +newtype NT2 a = NT2 (a -> Int) + +foo :: T NT1 -> T NT2 +foo = coerce + +main = return () diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr b/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr new file mode 100644 index 0000000000..d3d71e115f --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr @@ -0,0 +1,7 @@ + +TcCoercibleFail3.hs:12:7: + No instance for (Coercible NT1 NT2) + because ‛NT1’ and ‛NT2’ are different types. + arising from a use of ‛coerce’ + In the expression: coerce + In an equation for ‛foo’: foo = coerce diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index f14bb5fab2..749ea32ccd 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -319,6 +319,7 @@ test('T8262', normal, compile_fail, ['']) test('TcCoercibleFail', when(compiler_lt('ghc', '7.7'), skip), compile_fail, ['']) test('TcCoercibleFailSafe', when(compiler_lt('ghc', '7.7'), skip), compile_fail, ['']) test('TcCoercibleFail2', when(compiler_lt('ghc', '7.7'), skip), compile_fail, ['']) +test('TcCoercibleFail3', when(compiler_lt('ghc', '7.7'), skip), compile_fail, ['']) test('T8306', normal, compile_fail, ['']) test('T8392a', normal, compile_fail, ['']) test('T8428', normal, compile_fail, ['']) |