summaryrefslogtreecommitdiff
path: root/compiler/GHC/Runtime
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2021-10-11 14:58:46 +0200
committerBen Gamari <ben@well-typed.com>2021-10-13 01:07:45 +0000
commit0aae1b4e7bc7398ea1ef6ed3084dfabf9cf80ce3 (patch)
treef99f87fcc176c66cbc7dbc53c6ed38b376dabc72 /compiler/GHC/Runtime
parent4cf43b2a1d569a786e549962e867eb506f4fc76a (diff)
downloadhaskell-0aae1b4e7bc7398ea1ef6ed3084dfabf9cf80ce3.tar.gz
shadowNames: Accept an OccName, not a GreName
previously, the `shadowNames` function would take `[GreName]`. This has confused me for two reasons: * Why `GreName` and not `Name`? Does the difference between a normal name and a field name matter? The code of `shadowNames` shows that it does not, but really its better if the type signatures says so. * Why `Name` and not `OccName`? The point of `shadowNames` is to shadow _unqualified names_, at least in the two use cases I am aware of (names defined on the GHCI prompt or in TH splices). The code of `shadowNames` used to have cases that peek at the module of the given name and do something if that module appears in the `GlobalRdrElt`, but I think these cases are dead code, I don’t see how they could occur in the above use cases. Also, I replaced them with `errors` and GHC would still validate. Hence removing this code (yay!) This change also allows `shadowNames` to accept an `OccSet` instead, which allows for a faster implemenation; I’ll try that separately. This in stead might help with !6703.
Diffstat (limited to 'compiler/GHC/Runtime')
-rw-r--r--compiler/GHC/Runtime/Context.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Runtime/Context.hs b/compiler/GHC/Runtime/Context.hs
index 6b4a4d0624..aaf99ee9a7 100644
--- a/compiler/GHC/Runtime/Context.hs
+++ b/compiler/GHC/Runtime/Context.hs
@@ -367,7 +367,8 @@ icExtendGblRdrEnv env tythings
| otherwise
= foldl' extendGlobalRdrEnv env1 (concatMap localGREsFromAvail avail)
where
- env1 = shadowNames env (concatMap availGreNames avail)
+ new_gres = concatMap availGreNames avail
+ env1 = shadowNames env (map occName new_gres)
avail = tyThingAvailInfo thing
-- Ugh! The new_tythings may include record selectors, since they