summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorAdam Gundry <adam@well-typed.com>2021-02-05 22:19:59 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-10 10:33:36 -0500
commitd095954bc9dfcee9f3094bc4994b3a69df8f409d (patch)
tree02441eadf289f20d7a29fcbafea99f37b4e60e53 /compiler/GHC
parentafc357d269b6e1d56385220e78fe696c161e9bf7 (diff)
downloadhaskell-d095954bc9dfcee9f3094bc4994b3a69df8f409d.tar.gz
Do not remove shadowed record selectors from interactive context (fixes #19322)
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/Runtime/Context.hs5
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