diff options
author | Adam Gundry <adam@well-typed.com> | 2021-02-05 22:19:59 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-10 10:33:36 -0500 |
commit | d095954bc9dfcee9f3094bc4994b3a69df8f409d (patch) | |
tree | 02441eadf289f20d7a29fcbafea99f37b4e60e53 /compiler | |
parent | afc357d269b6e1d56385220e78fe696c161e9bf7 (diff) | |
download | haskell-d095954bc9dfcee9f3094bc4994b3a69df8f409d.tar.gz |
Do not remove shadowed record selectors from interactive context (fixes #19322)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Runtime/Context.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/GHC/Runtime/Context.hs b/compiler/GHC/Runtime/Context.hs index a69e358e32..243624553d 100644 --- a/compiler/GHC/Runtime/Context.hs +++ b/compiler/GHC/Runtime/Context.hs @@ -31,6 +31,7 @@ import GHC.Core.Type import GHC.Types.Avail import GHC.Types.Fixity.Env +import GHC.Types.Id ( isRecordSelector ) import GHC.Types.Id.Info ( IdDetails(..) ) import GHC.Types.Name import GHC.Types.Name.Env @@ -342,7 +343,9 @@ extendInteractiveContextWithIds ictxt new_ids shadowed_by :: [Id] -> TyThing -> Bool shadowed_by ids = shadowed where - shadowed id = getOccName id `elemOccSet` new_occs + -- Keep record selectors because they might be needed by HasField (#19322) + shadowed (AnId id) | isRecordSelector id = False + shadowed tything = getOccName tything `elemOccSet` new_occs new_occs = mkOccSet (map getOccName ids) setInteractivePrintName :: InteractiveContext -> Name -> InteractiveContext |