OverloadedRecordDot ignores DEPRECATED pragma
Summary
When using record dot syntax no warning is emitted when accessing fields marked as DEPRECATED.
Same stands for OverloadedLabels though that's a bit orthogonal. Pointing just for wider context as I believe both use the same class-based approach, so the root of the problem and possible fixes should be the same.
Is this a known issue (or maybe intended trade-off) and just me being unable to find relevant discussions?
Steps to reproduce
See https://gitlab.com/ste.vladimir/deprecated-fields-and-record-dot A short summary:
{-# LANGUAGE DeriveGeneric #-}
module Bar where
import GHC.Generics
data Bar = Bar
{ x :: Int
, y :: Char
} deriving (Generic)
{-# DEPRECATED x "Don't use me" #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedRecordDot #-}
module Foo where
import Bar
import Control.Lens
import Data.Generics.Labels ()
import GHC.Records
barRecord :: Bar
barRecord = Bar
{ x = 1 -- This shows a warning
, y = 'a'
}
barFieldAccessor :: Bar -> Int
barFieldAccessor = x -- This shows a warning
barDot :: Bar -> Int
barDot b = b.x -- This does not
barOverloadedLabel :: Bar -> Int
barOverloadedLabel = view #x -- This does not
barGetField :: Bar -> Int
barGetField = getField @"x" -- This does not
Expected behavior
Roughly the behavior should be identical to ordinary record fields and field accessors: warning is emitted when accessing deprecated field.
Environment
-
GHC version used: 9.2.7
I've just used the latest GHC version in hand. Let me know if you want me to test on the latest version.