diff options
author | nineonine <mail4chemik@gmail.com> | 2022-05-14 17:57:36 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-05-17 00:25:38 -0400 |
commit | 5f6527e05beb628c5015ab9f8a7f4012ee8d14a1 (patch) | |
tree | 0319c3ed7365ebe933d2aae87b808fea5769f0fc /compiler/GHC/Rename | |
parent | 03efe28317c5e037eab4d47790a6a1fb74d38c3d (diff) | |
download | haskell-5f6527e05beb628c5015ab9f8a7f4012ee8d14a1.tar.gz |
OverloadedRecordFields: mention parent name in 'ambiguous occurrence' error for better disambiguation (#17420)
Diffstat (limited to 'compiler/GHC/Rename')
-rw-r--r-- | compiler/GHC/Rename/Utils.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/GHC/Rename/Utils.hs b/compiler/GHC/Rename/Utils.hs index be0b12a278..4c1f2e59dc 100644 --- a/compiler/GHC/Rename/Utils.hs +++ b/compiler/GHC/Rename/Utils.hs @@ -564,12 +564,15 @@ addNameClashErrRn rdr_name gres -- imported from ‘Prelude’ at T15487.hs:1:8-13 -- or ... -- See #15487 - pp_greMangledName gre@(GRE { gre_name = child + pp_greMangledName gre@(GRE { gre_name = child, gre_par = par , gre_lcl = lcl, gre_imp = iss }) = case child of - FieldGreName fl -> text "the field" <+> quotes (ppr fl) + FieldGreName fl -> text "the field" <+> quotes (ppr fl) <+> parent_info NormalGreName name -> quotes (pp_qual name <> dot <> ppr (nameOccName name)) where + parent_info = case par of + NoParent -> empty + ParentIs { par_is = par_name } -> text "of record" <+> quotes (ppr par_name) pp_qual name | lcl = ppr (nameModule name) |