GHC 8.4.1-alpha allows the use of kind polymorphism without PolyKinds
This program:
```hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -ddump-deriv #-}
module Bug where
import Data.Coerce
import Data.Proxy
class C a b where
c :: Proxy (x :: a) -> b
newtype I a = MkI a
instance C x a => C x (Bug.I a) where
c = coerce @(forall (z :: x). Proxy z -> a)
@(forall (z :: x). Proxy z -> I a)
c
```
is rightfully rejected by GHC 8.2.2:
```
$ /opt/ghc/8.2.2/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:20:16: error:
Unexpected kind variables Perhaps you intended to use PolyKinds
In a type argument
|
20 | c = coerce @(forall (z :: x). Proxy z -> a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:21:16: error:
Unexpected kind variables Perhaps you intended to use PolyKinds
In a type argument
|
21 | @(forall (z :: x). Proxy z -> I a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
But GHC 8.4.1-alpha2 actually //accepts// this program!
```
$ /opt/ghc/8.4.1/bin/ghci Bug.hs
GHCi, version 8.4.0.20180118: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Ok, one module loaded.
```
This is almost certainly bogus.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.4.1-alpha1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC 8.4.1-alpha allows the use of kind polymorphism without PolyKinds","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.4.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1-alpha1","keywords":["PolyKinds"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This program:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE ImpredicativeTypes #-}\r\n{-# LANGUAGE KindSignatures #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# OPTIONS_GHC -ddump-deriv #-}\r\nmodule Bug where\r\n\r\nimport Data.Coerce\r\nimport Data.Proxy\r\n\r\nclass C a b where\r\n c :: Proxy (x :: a) -> b\r\n\r\nnewtype I a = MkI a\r\n\r\ninstance C x a => C x (Bug.I a) where\r\n c = coerce @(forall (z :: x). Proxy z -> a)\r\n @(forall (z :: x). Proxy z -> I a)\r\n c\r\n}}}\r\n\r\nis rightfully rejected by GHC 8.2.2:\r\n\r\n{{{\r\n$ /opt/ghc/8.2.2/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:20:16: error:\r\n Unexpected kind variables Perhaps you intended to use PolyKinds\r\n In a type argument\r\n |\r\n20 | c = coerce @(forall (z :: x). Proxy z -> a)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nBug.hs:21:16: error:\r\n Unexpected kind variables Perhaps you intended to use PolyKinds\r\n In a type argument\r\n |\r\n21 | @(forall (z :: x). Proxy z -> I a)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n}}}\r\n\r\nBut GHC 8.4.1-alpha2 actually //accepts// this program!\r\n\r\n{{{\r\n$ /opt/ghc/8.4.1/bin/ghci Bug.hs\r\nGHCi, version 8.4.0.20180118: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug.hs, interpreted )\r\nOk, one module loaded.\r\n}}}\r\n\r\nThis is almost certainly bogus.","type_of_failure":"OtherFailure","blocking":[]} -->
issue