Skip to content
Snippets Groups Projects
Commit ae63d0fa authored by Bartłomiej Cieślar's avatar Bartłomiej Cieślar Committed by Marge Bot
Browse files

Add cases to T23279: HasField for deprecated record fields

This commit adds additional tests from ticket #23279 to ensure that we don't
regress on reporting deprecated record fields in conjunction with HasField,
either when using overloaded record dot syntax or directly through `getField`.

Fixes #23279
parent 465a9a0b
No related branches found
No related tags found
No related merge requests found
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE DuplicateRecordFields, DataKinds
, OverloadedLabels, OverloadedRecordDot #-}
module T23279 where
import T23279_aux
import GHC.Records
bar :: Bar
bar = Bar { x = 3, y = 'x', z = False, w = 17.28 }
baz :: Baz
baz = Baz { z = 1.1 }
v = w
barDot :: Bar -> Int
barDot b = b.x
barGetField :: Bar -> Bool
barGetField = getField @"z"
T23279.hs:7:13: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
T23279.hs:11:13: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
In the use of record field of Bar ‘x’ (imported from T23279_aux):
Deprecated: "Don't use x"
T23279.hs:7:29: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
T23279.hs:11:29: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
In the use of record field of Bar ‘z’ (imported from T23279_aux):
Deprecated: "Don't use z"
T23279.hs:7:40: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
T23279.hs:11:40: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
In the use of record field of Bar ‘w’ (imported from T23279_aux):
Deprecated: "Don't use w"
T23279.hs:8:13: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
T23279.hs:14:13: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
In the use of record field of Baz ‘z’ (imported from T23279_aux):
Deprecated: "Don't use z"
T23279.hs:10:5: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
T23279.hs:16:5: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
In the use of ‘w’ (imported from T23279_aux):
Deprecated: "Don't use w"
T23279.hs:19:12: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
In the use of record field of Bar ‘x’ (imported from T23279_aux):
Deprecated: "Don't use x"
T23279.hs:22:15: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)]
In the use of record field of Bar ‘z’ (imported from T23279_aux):
Deprecated: "Don't use z"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment