Skip to content

-Wpartial-fields reports internal name when DuplicateRecordFields is enabled

If you compile this file:

{-# OPTIONS_GHC -Wpartial-fields #-}
module Bug where

data T
  = T1 { unT1 :: Int }
  | T2

Under normal circumstances, it will (correctly) warn that unT1 is partial:

$ /opt/ghc/9.0.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:5:10: warning: [-Wpartial-fields]
    Use of partial record field selector: ‘unT1’
  |
5 |   = T1 { unT1 :: Int }
  |          ^^^^

If DuplicateRecordFields is enabled, however, it will instead warn about a GHC-internal name:

$ /opt/ghc/9.0.1/bin/ghc Bug.hs -XDuplicateRecordFields
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o ) [flags changed]

Bug.hs:5:10: warning: [-Wpartial-fields]
    Use of partial record field selector: ‘$sel:unT1:T1’
  |
5 |   = T1 { unT1 :: Int }
  |          ^^^^
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information