diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T21328.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T21328.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T21328.hs b/testsuite/tests/typecheck/should_fail/T21328.hs new file mode 100644 index 0000000000..f589c5d3a7 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T21328.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE TypeFamilies #-} +module T21328 where + +import GHC.Exts +import Type.Reflection + +type family Id x +type instance Id x = x + +cast :: forall a. Id (TypeRep a) -> (Typeable a => Int) -> Int +cast = withDict @(TypeRep a) @(Typeable a) diff --git a/testsuite/tests/typecheck/should_fail/T21328.stderr b/testsuite/tests/typecheck/should_fail/T21328.stderr new file mode 100644 index 0000000000..a7d106a793 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T21328.stderr @@ -0,0 +1,4 @@ + +T21328.hs:11:8: error: + Invalid instantiation of ‘withDict’ at type: + Id (TypeRep a) -> (Typeable a => Int) -> Int diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index c856ca7e95..aceaf051c9 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -653,4 +653,5 @@ test('T20064', normal, compile_fail, ['']) test('T21130', normal, compile_fail, ['']) test('T20768_fail', normal, compile_fail, ['']) test('T21327', normal, compile_fail, ['']) +test('T21328', normal, compile_fail, ['']) test('T21338', normal, compile_fail, ['']) |