diff --git a/testsuite/tests/typecheck/should_compile/T10770a.hs b/testsuite/tests/typecheck/should_compile/T10770a.hs new file mode 100644 index 0000000000000000000000000000000000000000..611c86e35d742c8c1a223f20e904263a60a7ea2d --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T10770a.hs @@ -0,0 +1,8 @@ +module T10770a where + +import Data.Typeable + +main = print $ foo $ Just () + +foo :: Typeable (t a) => t a -> String +foo x = let k = show $ typeOf x in k diff --git a/testsuite/tests/typecheck/should_compile/T10770b.hs b/testsuite/tests/typecheck/should_compile/T10770b.hs new file mode 100644 index 0000000000000000000000000000000000000000..62ae61cb6b3b8f5a83197643603b7f32d59b2421 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T10770b.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# OPTIONS_GHC -fwarn-redundant-constraints #-} +module T10770b where + +f :: (Show a, Show (Maybe a)) => Maybe a -> String +f x = let k = show x in k + +g :: (Show a, Show (Maybe a)) => Maybe a -> String +g x = show x diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 6f34db479965404bbae6271052462425209216a0..da71c1d742c69c1f342e990c5174c890ed72ba89 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -475,3 +475,5 @@ test('T10642', normal, compile, ['']) test('T10744', normal, compile, ['']) test('update-existential', normal, compile, ['']) test('T10347', expect_broken(10347), compile, ['']) +test('T10770a', expect_broken(10770), compile, ['']) +test('T10770b', expect_broken(10770), compile, [''])