From 5f6527e05beb628c5015ab9f8a7f4012ee8d14a1 Mon Sep 17 00:00:00 2001 From: nineonine Date: Sat, 14 May 2022 17:57:36 -0700 Subject: OverloadedRecordFields: mention parent name in 'ambiguous occurrence' error for better disambiguation (#17420) --- compiler/GHC/Rename/Utils.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'compiler/GHC/Rename') 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) -- cgit v1.2.1