Core lint failure with TypeLits Symbol
The following module:
```
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Bug where
import GHC.TypeLits ( Symbol, KnownSymbol )
--------------------------------------------------------------------------------
data Meta = MetaCons Symbol
data M1 (c :: Meta) = M1
class Generic a where
type Rep a :: *
from :: a -> Rep a
--------------------------------------------------------------------------------
data A = A1
instance Generic A where
type Rep A = M1 ('MetaCons "test")
from A1 = M1
class GShow' f where
gshowsPrec' :: f -> ShowS
instance (KnownSymbol c) => GShow' (M1 ('MetaCons c))
instance GShow' A where gshowsPrec' = gshowsPrec' . from
```
fails `-dcore-lint` in HEAD with:
```
*** Core Lint errors : in result of Desugar (after optimization) ***
<no location info>: Warning:
[RHS of $dKnownSymbol_azn :: GHC.TypeLits.KnownSymbol "test"]
From-type of Cast differs from type of enclosed expression
From-type: GHC.TypeLits.KnownSymbol "test"
Type of enclosed expr: [GHC.Types.Char]
Actual enclosed expr: GHC.CString.unpackCString# "test"#
Coercion used in cast: GHC.TypeLits.NTCo:KnownSymbol[0] <"test">_N
; GHC.TypeLits.NTCo:SSymbol[0] <"test">_P
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.9 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Core lint failure with TypeLits Symbol","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.9","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following module:\r\n\r\n{{{\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n\r\nmodule Bug where\r\n\r\nimport GHC.TypeLits ( Symbol, KnownSymbol )\r\n\r\n--------------------------------------------------------------------------------\r\n\r\ndata Meta = MetaCons Symbol\r\ndata M1 (c :: Meta) = M1\r\n\r\nclass Generic a where\r\n type Rep a :: *\r\n from :: a -> Rep a\r\n\r\n--------------------------------------------------------------------------------\r\n\r\ndata A = A1\r\n\r\ninstance Generic A where\r\n type Rep A = M1 ('MetaCons \"test\")\r\n from A1 = M1\r\n\r\nclass GShow' f where\r\n gshowsPrec' :: f -> ShowS\r\n\r\ninstance (KnownSymbol c) => GShow' (M1 ('MetaCons c))\r\ninstance GShow' A where gshowsPrec' = gshowsPrec' . from\r\n}}}\r\n\r\nfails `-dcore-lint` in HEAD with:\r\n{{{\r\n*** Core Lint errors : in result of Desugar (after optimization) ***\r\n<no location info>: Warning:\r\n [RHS of $dKnownSymbol_azn :: GHC.TypeLits.KnownSymbol \"test\"]\r\n From-type of Cast differs from type of enclosed expression\r\n From-type: GHC.TypeLits.KnownSymbol \"test\"\r\n Type of enclosed expr: [GHC.Types.Char]\r\n Actual enclosed expr: GHC.CString.unpackCString# \"test\"#\r\n Coercion used in cast: GHC.TypeLits.NTCo:KnownSymbol[0] <\"test\">_N\r\n ; GHC.TypeLits.NTCo:SSymbol[0] <\"test\">_P\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->
issue