diff options
author | Adam Gundry <adam@well-typed.com> | 2021-02-04 22:13:21 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-10 10:33:36 -0500 |
commit | 5581e7b4c3ab6aa2bb7cca6ed917ed40ad3ed423 (patch) | |
tree | ea2ce6a75ce1c3f3c506973c9405ecf4871cc22f /compiler/GHC/Rename | |
parent | d095954bc9dfcee9f3094bc4994b3a69df8f409d (diff) | |
download | haskell-5581e7b4c3ab6aa2bb7cca6ed917ed40ad3ed423.tar.gz |
Simplify shadowing of DuplicateRecordFields in GHCi (fixes #19314)
Previously, defining fields with DuplicateRecordFields in GHCi lead to
strange shadowing behaviour, whereby fields would (accidentally) not
shadow other fields. This simplifies things so that fields are shadowed
in the same way whether or not DuplicateRecordFields is enabled.
Diffstat (limited to 'compiler/GHC/Rename')
-rw-r--r-- | compiler/GHC/Rename/Names.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs index 6dff5b195e..92e1309bd6 100644 --- a/compiler/GHC/Rename/Names.hs +++ b/compiler/GHC/Rename/Names.hs @@ -624,7 +624,8 @@ extendGlobalRdrEnvRn avails new_fixities | otherwise = rdr_env lcl_env3 = lcl_env2 { tcl_th_bndrs = extendNameEnvList th_bndrs - [ (n, (TopLevel, th_lvl)) + [ ( greNameMangledName n + , (TopLevel, th_lvl) ) | n <- new_names ] } ; rdr_env2 <- foldlM add_gre rdr_env1 new_gres @@ -635,8 +636,8 @@ extendGlobalRdrEnvRn avails new_fixities ; traceRn "extendGlobalRdrEnvRn 2" (pprGlobalRdrEnv True rdr_env2) ; return (gbl_env', lcl_env3) } where - new_names = concatMap availNames avails - new_occs = map nameOccName new_names + new_names = concatMap availGreNames avails + new_occs = map occName new_names -- If there is a fixity decl for the gre, add it to the fixity env extend_fix_env fix_env gre |