Add regression tests for #12947, #13640
authorRyan Scott <ryan.gl.scott@gmail.com>
Sat, 6 May 2017 16:31:40 +0000 (12:31 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Sat, 6 May 2017 16:32:13 +0000 (12:32 -0400)
Summary:
Commit b4bdbe4957ae8b82c4cda5584203b44d3c4f004f (the fix for #12156)
wound up being the fix for #12947 and #13640 as well. This adds regression
tests for the latter two tickets to keep them fixed.

Test Plan: make test TEST="T12947 T13640"

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #12947, #13640

Differential Revision: https://phabricator.haskell.org/D3528

testsuite/tests/typecheck/should_fail/T12947.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T12947.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T13640.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T13640.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T12947.hs b/testsuite/tests/typecheck/should_fail/T12947.hs
new file mode 100644 (file)
index 0000000..d8a837c
--- /dev/null
@@ -0,0 +1,15 @@
+{-# OPTIONS_GHC -dcore-lint -fdefer-typed-holes #-}
+module T12947 where
+
+import qualified Control.Monad.Fail as Fail
+
+newtype P m a = P { unP :: (a -> IO (m ())) -> IO (m ()) }
+
+instance Functor (P m) where
+
+instance Applicative (P m) where
+
+instance Monad (P m) where
+
+instance (Fail.MonadFail m) => Fail.MonadFail (P m) where
+  fail msg = ContT $ \ _ -> Fail.fail msg
diff --git a/testsuite/tests/typecheck/should_fail/T12947.stderr b/testsuite/tests/typecheck/should_fail/T12947.stderr
new file mode 100644 (file)
index 0000000..a5d9193
--- /dev/null
@@ -0,0 +1,3 @@
+
+T12947.hs:15:14: error:
+    Data constructor not in scope: ContT :: (p0 -> m0 a0) -> P m a
diff --git a/testsuite/tests/typecheck/should_fail/T13640.hs b/testsuite/tests/typecheck/should_fail/T13640.hs
new file mode 100644 (file)
index 0000000..be0faf7
--- /dev/null
@@ -0,0 +1,13 @@
+{-# OPTIONS_GHC -dcore-lint -fdefer-typed-holes #-}
+module T13640 where
+
+import Prelude hiding ((.))
+
+class Functor' f where
+  map' :: (a -> b) -> f a -> f b
+
+class Bifunctor' f where
+  map2' :: (a -> b) -> f a c -> f b c
+
+bimap' :: Bifunctor' f => (a -> b) -> (c -> d) -> (f a c -> f b d)
+bimap' f g = map2' f . map'
diff --git a/testsuite/tests/typecheck/should_fail/T13640.stderr b/testsuite/tests/typecheck/should_fail/T13640.stderr
new file mode 100644 (file)
index 0000000..d926dd9
--- /dev/null
@@ -0,0 +1,8 @@
+
+T13640.hs:13:22: error:
+    • Variable not in scope:
+        (.)
+          :: (f0 a c0 -> f0 b c0)
+             -> ((a0 -> b0) -> f1 a0 -> f1 b0) -> f a c -> f b d
+    • Perhaps you want to remove ‘.’ from the explicit hiding list
+      in the import of ‘Prelude’ (T13640.hs:4:1-27).
index 3aa8cd5..4a409e0 100644 (file)
@@ -422,6 +422,7 @@ test('T12837', normal, compile_fail, [''])
 test('T12918a', normal, compile_fail, [''])
 test('T12918b', normal, compile_fail, [''])
 test('T12921', normal, compile_fail, [''])
+test('T12947', normal, compile_fail, [''])
 test('T12973', normal, compile_fail, [''])
 test('StrictBinds', normal, compile_fail, [''])
 test('T13068', [extra_files(['T13068.hs', 'T13068a.hs', 'T13068.hs-boot', 'T13068m.hs'])], multimod_compile_fail, ['T13068m', ''])
@@ -436,3 +437,4 @@ test('T13446', normal, compile_fail, [''])
 test('T13506', normal, compile_fail, [''])
 test('T13611', expect_broken(13611), compile_fail, [''])
 test('T13320', normal, compile_fail, [''])
+test('T13640', normal, compile_fail, [''])