diff options
author | Adam Gundry <adam@well-typed.com> | 2018-06-17 10:47:57 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-17 11:16:44 -0400 |
commit | ccd8ce405db89142932daea3fdace8814b110798 (patch) | |
tree | 47ce56a9d5685312d0e70ea7a2e711090a129c27 /compiler/rename/RnNames.hs | |
parent | 9897440ec9fbf17fb609e9a0d9456861c5f7f24a (diff) | |
download | haskell-ccd8ce405db89142932daea3fdace8814b110798.tar.gz |
Handle DuplicateRecordFields correctly in filterImports (fixes #14487)
filterImports needed a small adjustment to correctly handle record field
definitions arising from modules with DuplicateRecordFields enabled.
Previously hiding fields was not possible with DuplicateRecordFields enabled.
Test Plan: new test rename/should_compile/T14487
Reviewers: bgamari
Subscribers: simonpj, rwbarton, thomie, carter
GHC Trac Issues: #14487
Differential Revision: https://phabricator.haskell.org/D4805
Diffstat (limited to 'compiler/rename/RnNames.hs')
-rw-r--r-- | compiler/rename/RnNames.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index f06fc00db3..d377f5e535 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -863,7 +863,7 @@ filterImports iface decl_spec (Just (want_hiding, L l import_items)) -- NB the AvailInfo may have duplicates, and several items -- for the same parent; e.g N(x) and N(y) - names = availsToNameSet (map snd items2) + names = availsToNameSetWithSelectors (map snd items2) keep n = not (n `elemNameSet` names) pruned_avails = filterAvails keep all_avails hiding_spec = ImpSpec { is_decl = decl_spec, is_item = ImpAll } @@ -879,8 +879,9 @@ filterImports iface decl_spec (Just (want_hiding, L l import_items)) imp_occ_env :: OccEnv (Name, -- the name AvailInfo, -- the export item providing the name Maybe Name) -- the parent of associated types - imp_occ_env = mkOccEnv_C combine [ (nameOccName n, (n, a, Nothing)) - | a <- all_avails, n <- availNames a] + imp_occ_env = mkOccEnv_C combine [ (occ, (n, a, Nothing)) + | a <- all_avails + , (n, occ) <- availNamesWithOccs a] where -- See Note [Dealing with imports] -- 'combine' is only called for associated data types which appear |