Template Haskell gets confused with scoped kind variables in a class declaration
When I say
```
{-# LANGUAGE TemplateHaskell, DataKinds, PolyKinds, TypeFamilies #-}
module Bug where
import Data.Proxy
$( [d|
class kproxy ~ 'KProxy => C (kproxy :: KProxy a) where
type TF (x :: a) :: Bool
|])
```
I get
```
/Users/rae/temp/Bug.hs:7:4:
Kind variable also used as type variable: ‘a_asJA’
In the declaration for class C_asJy
/Users/rae/temp/Bug.hs:7:4:
The exact Name ‘kproxy_asJB’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
```
The code in the TH quote compiles fine on its own.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Template Haskell gets confused with scoped kind variables in a class declaration","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When I say\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell, DataKinds, PolyKinds, TypeFamilies #-}\r\n\r\nmodule Bug where\r\n\r\nimport Data.Proxy\r\n\r\n$( [d|\r\n class kproxy ~ 'KProxy => C (kproxy :: KProxy a) where\r\n type TF (x :: a) :: Bool\r\n |])\r\n}}}\r\n\r\nI get\r\n\r\n{{{\r\n/Users/rae/temp/Bug.hs:7:4:\r\n Kind variable also used as type variable: ‘a_asJA’\r\n In the declaration for class C_asJy\r\n\r\n/Users/rae/temp/Bug.hs:7:4:\r\n The exact Name ‘kproxy_asJB’ is not in scope\r\n Probable cause: you used a unique Template Haskell name (NameU), \r\n perhaps via newName, but did not bind it\r\n If that's it, then -ddump-splices might be useful\r\n}}}\r\n\r\nThe code in the TH quote compiles fine on its own.","type_of_failure":"OtherFailure","blocking":[]} -->
issue