
#16411: Inconsistent -Wpartial-fields warnings with (~) vs. (~~) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.4 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16411 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler