diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-12-06 11:44:18 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-12-06 13:23:59 +0000 |
commit | 99cd027f471886f08a70b6c6d4a17601a11431a1 (patch) | |
tree | 3e16173d5352bb2d328e9b3c6bb53d33781ef210 /compiler/GHC/Tc | |
parent | a9e035a430c7fdc228d56d21b27b3b8e815fd06b (diff) | |
download | haskell-wip/20779.tar.gz |
package imports: Take into account package visibility when renamingwip/20779
In 806e49ae the package imports refactoring code was modified to rename
package imports. There was a small oversight which meant the code didn't
account for module visibility. This patch fixes that oversight.
In general the "lookupPackageName" function is unsafe to use as it
doesn't account for package visiblity/thinning/renaming etc, there is
just one use in the compiler which would be good to audit.
Fixes #20779
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r-- | compiler/GHC/Tc/Module.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs index dca730f6f0..6dfcf5d357 100644 --- a/compiler/GHC/Tc/Module.hs +++ b/compiler/GHC/Tc/Module.hs @@ -272,7 +272,7 @@ tcRnModuleTcRnM hsc_env mod_sum ; -- TODO This is a little skeevy; maybe handle a bit more directly let { simplifyImport (L _ idecl) = - ( renameRawPkgQual (hsc_unit_env hsc_env) (ideclPkgQual idecl) + ( renameRawPkgQual (hsc_unit_env hsc_env) (unLoc $ ideclName idecl) (ideclPkgQual idecl) , reLoc $ ideclName idecl) } ; raw_sig_imports <- liftIO @@ -2056,7 +2056,7 @@ runTcInteractive hsc_env thing_inside case i of -- force above: see #15111 IIModule n -> getOrphans n NoPkgQual IIDecl i -> getOrphans (unLoc (ideclName i)) - (renameRawPkgQual (hsc_unit_env hsc_env) (ideclPkgQual i)) + (renameRawPkgQual (hsc_unit_env hsc_env) (unLoc $ ideclName i) (ideclPkgQual i)) ; let imports = emptyImportAvails { imp_orphs = orphs |