Commit a37c6ad6 authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Test case for undersaturated newtype in Coercions

This is related to #8541.
parent 483ff505
{-# 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 ()
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
...@@ -319,6 +319,7 @@ test('T8262', normal, compile_fail, ['']) ...@@ -319,6 +319,7 @@ test('T8262', normal, compile_fail, [''])
test('TcCoercibleFail', when(compiler_lt('ghc', '7.7'), skip), 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('TcCoercibleFailSafe', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])
test('TcCoercibleFail2', 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('T8306', normal, compile_fail, [''])
test('T8392a', normal, compile_fail, ['']) test('T8392a', normal, compile_fail, [''])
test('T8428', normal, compile_fail, ['']) test('T8428', normal, compile_fail, [''])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment