Inconsistent -Wpartial-fields warnings with (~) vs. (~~)
In this program:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wpartial-fields #-}
module Bug where
import Data.Type.Equality
data T1 z where
MkT1a :: { rec1 :: () } -> T1 Int
MkT1b :: (z ~ Bool) => T1 z
data T2 z where
MkT2a :: { rec2 :: () } -> T2 Int
MkT2b :: (z ~~ Bool) => T2 z
```
I get no `-Wpartial-fields`–related warnings for `rec1`, but I do for `rec2`:
```
GHCi, version 8.6.4: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:13:14: warning: [-Wpartial-fields]
Use of partial record field selector: ‘rec2’
|
13 | MkT2a :: { rec2 :: () } -> T2 Int
| ^^^^
```
This feels strangely inconsistent, since if GHC doesn't warn for `rec1`, which uses `(~)`, then I feel like it shouldn't warn for `rec2` either, as the only difference is that the surrounding constructor uses a slightly different equality constraint `(~~)`.
The reason this happens is because the `dataConCannotMatch` function has special reasoning for `(~)`, but not `(~~)`. Patch incoming.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.4 |
| 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":"Inconsistent -Wpartial-fields warnings with (~) vs. (~~)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In this program:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# OPTIONS_GHC -Wpartial-fields #-}\r\nmodule Bug where\r\n\r\nimport Data.Type.Equality\r\n\r\ndata T1 z where\r\n MkT1a :: { rec1 :: () } -> T1 Int\r\n MkT1b :: (z ~ Bool) => T1 z\r\n\r\ndata T2 z where\r\n MkT2a :: { rec2 :: () } -> T2 Int\r\n MkT2b :: (z ~~ Bool) => T2 z\r\n}}}\r\n\r\nI get no `-Wpartial-fields`–related warnings for `rec1`, but I do for `rec2`:\r\n\r\n{{{\r\nGHCi, version 8.6.4: 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\n\r\nBug.hs:13:14: warning: [-Wpartial-fields]\r\n Use of partial record field selector: ‘rec2’\r\n |\r\n13 | MkT2a :: { rec2 :: () } -> T2 Int\r\n | ^^^^\r\n}}}\r\n\r\nThis feels strangely inconsistent, since if GHC doesn't warn for `rec1`, which uses `(~)`, then I feel like it shouldn't warn for `rec2` either, as the only difference is that the surrounding constructor uses a slightly different equality constraint `(~~)`.\r\n\r\nThe reason this happens is because the `dataConCannotMatch` function has special reasoning for `(~)`, but not `(~~)`. Patch incoming.","type_of_failure":"OtherFailure","blocking":[]} -->
issue