[Git][ghc/ghc][master] TcRnDuplicateDecls now suggests to use the DuplicateRecordFields extension.

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Nov 8 00:30:05 UTC 2024



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


Commits:
7d42b2df by tristian at 2024-11-07T19:29:40-05:00
TcRnDuplicateDecls now suggests to use the DuplicateRecordFields extension.

Fixes: !24627

- - - - -


3 changed files:

- compiler/GHC/Tc/Errors/Ppr.hs
- testsuite/tests/overloadedrecflds/should_fail/NFSDuplicate.stderr
- testsuite/tests/rename/should_fail/rn_dup.stderr


Changes:

=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -3253,8 +3253,8 @@ instance Diagnostic TcRnMessage where
       -> noHints
     TcRnUnusedImport{}
       -> noHints
-    TcRnDuplicateDecls{}
-      -> noHints
+    TcRnDuplicateDecls _ fs
+      -> [suggestExtension LangExt.DuplicateRecordFields | all isFieldName fs]
     TcRnPackageImportsDisabled
       -> [suggestExtension LangExt.PackageImports]
     TcRnIllegalDataCon{}


=====================================
testsuite/tests/overloadedrecflds/should_fail/NFSDuplicate.stderr
=====================================
@@ -1,5 +1,7 @@
-
 NFSDuplicate.hs:8:16: error: [GHC-29916]
     Multiple declarations of ‘foo’
     Declared at: NFSDuplicate.hs:7:16
                  NFSDuplicate.hs:8:16
+    Suggested fix:
+      Perhaps you intended to use the ‘DuplicateRecordFields’ extension
+


=====================================
testsuite/tests/rename/should_fail/rn_dup.stderr
=====================================
@@ -1,4 +1,3 @@
-
 rn_dup.hs:9:10: error: [GHC-29916]
     Multiple declarations of ‘MkT’
     Declared at: rn_dup.hs:7:16
@@ -16,6 +15,8 @@ rn_dup.hs:12:16: error: [GHC-29916]
     Multiple declarations of ‘rf’
     Declared at: rn_dup.hs:11:27
                  rn_dup.hs:12:16
+    Suggested fix:
+      Perhaps you intended to use the ‘DuplicateRecordFields’ extension
 
 rn_dup.hs:17:3: error: [GHC-29916]
     Multiple declarations of ‘CT’
@@ -26,3 +27,4 @@ rn_dup.hs:18:3: error: [GHC-29916]
     Multiple declarations of ‘f’
     Declared at: rn_dup.hs:16:3
                  rn_dup.hs:18:3
+



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7d42b2df006c50aecfeea6f6a53b9b198f5764bf
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/20241107/32e860a5/attachment-0001.html>


More information about the ghc-commits mailing list