Add regression tests for #11515 and #12563
authorRyan Scott <ryan.gl.scott@gmail.com>
Fri, 18 May 2018 15:50:07 +0000 (11:50 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Fri, 18 May 2018 15:50:18 +0000 (11:50 -0400)
Happily, both of these issues appear to have been fixed in GHC 8.2.
Let's add regression tests for them to ensure that they stay fixed.

testsuite/tests/partial-sigs/should_fail/T11515.hs [new file with mode: 0644]
testsuite/tests/partial-sigs/should_fail/T11515.stderr [new file with mode: 0644]
testsuite/tests/partial-sigs/should_fail/all.T
testsuite/tests/typecheck/should_fail/T12563.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T12563.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/partial-sigs/should_fail/T11515.hs b/testsuite/tests/partial-sigs/should_fail/T11515.hs
new file mode 100644 (file)
index 0000000..2a03e24
--- /dev/null
@@ -0,0 +1,8 @@
+{-# LANGUAGE ConstraintKinds, TypeFamilies #-}
+
+module T11515 where
+
+type family ShowSyn a where ShowSyn a = Show a
+
+foo :: (ShowSyn a, _) => a -> String
+foo x = show x
diff --git a/testsuite/tests/partial-sigs/should_fail/T11515.stderr b/testsuite/tests/partial-sigs/should_fail/T11515.stderr
new file mode 100644 (file)
index 0000000..2870457
--- /dev/null
@@ -0,0 +1,5 @@
+
+T11515.hs:7:20: error:
+    • Found type wildcard ‘_’ standing for ‘()’
+      To use the inferred type, enable PartialTypeSignatures
+    • In the type signature: foo :: (ShowSyn a, _) => a -> String
index 2439f64..9866029 100644 (file)
@@ -59,6 +59,7 @@ test('T10615', normal, compile_fail, [''])
 test('T10045', normal, compile_fail, [''])
 test('T10999', normal, compile_fail, [''])
 test('T11122', normal, compile, [''])
+test('T11515', normal, compile_fail, [''])
 test('T11976', normal, compile_fail, [''])
 test('PatBind3', normal, compile_fail, [''])
 test('T12039', normal, compile_fail, [''])
diff --git a/testsuite/tests/typecheck/should_fail/T12563.hs b/testsuite/tests/typecheck/should_fail/T12563.hs
new file mode 100644 (file)
index 0000000..394fa61
--- /dev/null
@@ -0,0 +1,7 @@
+{-# LANGUAGE RankNTypes #-}
+module T12563 where
+
+foo :: ((forall a. f a) -> f r) -> f r
+foo g = undefined
+
+x = \g -> foo g
diff --git a/testsuite/tests/typecheck/should_fail/T12563.stderr b/testsuite/tests/typecheck/should_fail/T12563.stderr
new file mode 100644 (file)
index 0000000..f32e99d
--- /dev/null
@@ -0,0 +1,11 @@
+
+T12563.hs:7:15: error:
+    • Cannot instantiate unification variable ‘p0’
+      with a type involving foralls: (forall a. f0 a) -> f0 r0
+        GHC doesn't yet support impredicative polymorphism
+    • In the first argument of ‘foo’, namely ‘g’
+      In the expression: foo g
+      In the expression: \ g -> foo g
+    • Relevant bindings include
+        g :: p0 (bound at T12563.hs:7:6)
+        x :: p0 -> f0 r0 (bound at T12563.hs:7:1)
index e4aa682..5a3e733 100644 (file)
@@ -415,6 +415,7 @@ test('T12170a', normal, compile_fail, [''])
 test('T12124', normal, compile_fail, [''])
 test('T12589', normal, compile_fail, [''])
 test('T12529', normal, compile_fail, [''])
+test('T12563', normal, compile_fail, [''])
 test('T12648', normal, compile_fail, [''])
 test('T12729', normal, compile_fail, [''])
 test('T12785b', normal, compile_fail, [''])