-Wpartial-fields does not catch underscore prefix with OverloadedRecordDot
Summary
I think an underscore field prefix prevents generating a field selector, so -Wpartial-fields
ignores these, but with OverloadedRecordDot
they can still be used and generate errors if partial.
Steps to reproduce
Playground comparing unprefixed and prefixed fields: https://play.haskell.org/saved/nEVaLhMF
Minimal reproduction: https://play.haskell.org/saved/CzTFBwzM
{-# LANGUAGE OverloadedRecordDot #-}
{-# OPTIONS -Wpartial-fields #-}
data Visitor where
Member :: { _name :: String } -> Visitor
NonMember :: {} -> Visitor
main :: IO ()
main = putStrLn (makeGreeting NonMember {})
makeGreeting :: Visitor -> String
makeGreeting visitor =
visitor._name
Expected behavior
With the OverloadedRecordDot
extension enabled, the -Wpartial-fields
should consider underscore prefix fields.
Environment
- GHC version used: 9.8.1-alpha1