diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-10-21 14:31:39 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-10-21 14:32:44 +0200 |
commit | 68a084f378fbab857ccea81643eee15254b2917b (patch) | |
tree | 1e279b56e6dbf0c06279dd9ef3c3c541e34b55e5 | |
parent | bb7e93c9c78bdf746e34cf6715eeffa6dd5682de (diff) | |
download | haskell-68a084f378fbab857ccea81643eee15254b2917b.tar.gz |
Testsuite: add test for #10997
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T10997.hs | 15 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T10997a.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 2 |
3 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T10997.hs b/testsuite/tests/typecheck/should_compile/T10997.hs new file mode 100644 index 0000000000..18ec4ac183 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T10997.hs @@ -0,0 +1,15 @@ +module T10997 where + +import T10997a + +{- With ghc-7.10.2: + + The interface for ‘T10997a’ + Declaration for Just' + Pattern synonym Just': + Iface type variable out of scope: k + Cannot continue after interface file error +-} + +bar :: (Showable a) => Maybe a -> Maybe a +bar (Just' a) = Just' a diff --git a/testsuite/tests/typecheck/should_compile/T10997a.hs b/testsuite/tests/typecheck/should_compile/T10997a.hs new file mode 100644 index 0000000000..dc85d62cb6 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T10997a.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE PatternSynonyms, ViewPatterns, ConstraintKinds, TypeFamilies, PolyKinds, KindSignatures #-} +module T10997a where + +import GHC.Exts + +type family Showable (a :: k) :: Constraint where + Showable (a :: *) = (Show a) + Showable a = () + +extractJust :: Maybe a -> (Bool, a) +extractJust (Just a) = (True, a) +extractJust _ = (False, undefined) + +pattern Just' :: () => (Showable a) => a -> (Maybe a) +pattern Just' a <- (extractJust -> (True, a)) where + Just' a = Just a + diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index ed0c8e1f19..d7271b7afd 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -479,3 +479,5 @@ test('T10770a', expect_broken(10770), compile, ['']) test('T10770b', expect_broken(10770), compile, ['']) test('T10935', normal, compile, ['']) test('T10971a', normal, compile, ['']) +test('T10997', expect_broken(10997), + multi_compile, ['T10997', [('T10997a.hs', '')], '-v0']) |