summaryrefslogtreecommitdiff
path: root/testsuite/tests/dependent
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2018-06-16 23:44:39 -0400
committerBen Gamari <ben@smart-cactus.org>2018-06-16 23:44:57 -0400
commit8df24474d0194d28b8273c1539af05793156e23f (patch)
treeeeeaf190edb831e45fb23af1960213b530637794 /testsuite/tests/dependent
parent4cd552184cbc5bed33da21497537df4e400a1a2f (diff)
downloadhaskell-8df24474d0194d28b8273c1539af05793156e23f.tar.gz
Warn about implicit kind variables with -Wcompat
According to an accepted proposal https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/002 4-no-kind-vars.rst With -Wcompat, warn if a kind variable is brought into scope implicitly in a type with an explicit forall. This applies to type signatures and to other contexts that allow a forall with the forall-or-nothing rule in effect (for example, class instances). Test Plan: Validate Reviewers: goldfire, hvr, bgamari, RyanGlScott Reviewed By: goldfire Subscribers: RyanGlScott, rwbarton, thomie, carter GHC Trac Issues: #15264 Differential Revision: https://phabricator.haskell.org/D4834
Diffstat (limited to 'testsuite/tests/dependent')
-rw-r--r--testsuite/tests/dependent/should_compile/T15264.hs15
-rw-r--r--testsuite/tests/dependent/should_compile/T15264.stderr10
-rw-r--r--testsuite/tests/dependent/should_compile/all.T1
3 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/dependent/should_compile/T15264.hs b/testsuite/tests/dependent/should_compile/T15264.hs
new file mode 100644
index 0000000000..a03cf4346e
--- /dev/null
+++ b/testsuite/tests/dependent/should_compile/T15264.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE ExplicitForAll, PolyKinds #-}
+{-# OPTIONS -Wcompat #-}
+
+module T15264 where
+
+import Data.Proxy
+
+bad1 :: forall (a :: k). Proxy a -> ()
+bad1 _ = ()
+
+bad2 :: forall (a :: k1) (b :: k2). Proxy a -> ()
+bad2 _ = ()
+
+good :: forall k (a :: k). Proxy a -> ()
+good _ = ()
diff --git a/testsuite/tests/dependent/should_compile/T15264.stderr b/testsuite/tests/dependent/should_compile/T15264.stderr
new file mode 100644
index 0000000000..222d686513
--- /dev/null
+++ b/testsuite/tests/dependent/should_compile/T15264.stderr
@@ -0,0 +1,10 @@
+
+T15264.hs:8:22: warning: [-Wimplicit-kind-vars (in -Wcompat)]
+ An explicit ‘forall’ was used, but the following kind variables are not quantified: ‘k’
+ Despite this fact, GHC will introduce them into scope, but it will stop doing so in the future.
+ Suggested fix: add ‘forall k.’
+
+T15264.hs:11:22: warning: [-Wimplicit-kind-vars (in -Wcompat)]
+ An explicit ‘forall’ was used, but the following kind variables are not quantified: ‘k1’, ‘k2’
+ Despite this fact, GHC will introduce them into scope, but it will stop doing so in the future.
+ Suggested fix: add ‘forall k1 k2.’
diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T
index 40ba2110f9..2865351ff5 100644
--- a/testsuite/tests/dependent/should_compile/all.T
+++ b/testsuite/tests/dependent/should_compile/all.T
@@ -48,4 +48,5 @@ test('T14720', normal, compile, [''])
test('T14066a', normal, compile, [''])
test('T14749', normal, compile, [''])
test('T14991', normal, compile, [''])
+test('T15264', normal, compile, [''])
test('DkNameRes', normal, compile, ['']) \ No newline at end of file