Testsuite: add test for #10997
authorThomas Miedema <thomasmiedema@gmail.com>
Wed, 21 Oct 2015 12:31:39 +0000 (14:31 +0200)
committerThomas Miedema <thomasmiedema@gmail.com>
Wed, 21 Oct 2015 12:32:44 +0000 (14:32 +0200)
testsuite/tests/typecheck/should_compile/T10997.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T10997a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T

diff --git a/testsuite/tests/typecheck/should_compile/T10997.hs b/testsuite/tests/typecheck/should_compile/T10997.hs
new file mode 100644 (file)
index 0000000..18ec4ac
--- /dev/null
@@ -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 (file)
index 0000000..dc85d62
--- /dev/null
@@ -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
+
index ed0c8e1..d7271b7 100644 (file)
@@ -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'])