[Git][ghc/ghc][master] Add cases to T23279: HasField for deprecated record fields

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Aug 1 18:49:04 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
ae63d0fa by Bartłomiej Cieślar at 2023-08-01T14:48:40-04:00
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

- - - - -


2 changed files:

- testsuite/tests/overloadedrecflds/should_compile/T23279.hs
- testsuite/tests/overloadedrecflds/should_compile/T23279.stderr


Changes:

=====================================
testsuite/tests/overloadedrecflds/should_compile/T23279.hs
=====================================
@@ -1,10 +1,23 @@
-{-# 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"
+


=====================================
testsuite/tests/overloadedrecflds/should_compile/T23279.stderr
=====================================
@@ -1,20 +1,28 @@
 
-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"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ae63d0faf400185564d1165b46801e5234908a14

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ae63d0faf400185564d1165b46801e5234908a14
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230801/b0d5522e/attachment-0001.html>


More information about the ghc-commits mailing list