Simon Hengel pushed to branch wip/sol/reexported-error-message at Glasgow Haskell Compiler / GHC Commits: fcfa795a by Simon Hengel at 2026-06-22T13:35:29+07:00 Refactoring - - - - - 3 changed files: - compiler/GHC/Unit/State.hs - testsuite/tests/package/ImportReexport.hs - testsuite/tests/package/ImportReexport.stderr Changes: ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -1969,24 +1969,28 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn classify (hidden_pkg, hidden_mod, unusable, exposed) (m, origin0) = let origin = filterOrigin mb_pn (mod_unit m) origin0 x = (m, origin) - - originUnit :: [UnitInfo] -> [UnitInfo] - originUnit - | moduleName m == name, Just pkg <- lookupUnit pkgs (moduleUnit m) = (pkg :) - | otherwise = id - in case origin of ModHidden -> (hidden_pkg, x:hidden_mod, unusable, exposed) ModUnusable _ -> (hidden_pkg, hidden_mod, x:unusable, exposed) - ModOrigin _ _ reexports _ + ModOrigin { fromOrigUnit, fromHiddenReexport } | originEmpty origin -> (hidden_pkg, hidden_mod, unusable, exposed) | originVisible origin -> (hidden_pkg, hidden_mod, unusable, x:exposed) | otherwise - -> (reexports ++ originUnit hidden_pkg, hidden_mod, unusable, exposed) + -> (fromHiddenReexport ++ maybe id (:) origUnit hidden_pkg, hidden_mod, unusable, exposed) + where + origUnit :: Maybe UnitInfo + origUnit + | origAvailableUnderSameName = lookupUnit pkgs (moduleUnit m) + | otherwise = Nothing + + origAvailableUnderSameName :: Bool + origAvailableUnderSameName = case fromOrigUnit of + Nothing -> False + Just _ -> True unit_lookup p = lookupUnit pkgs p `orElse` pprPanic "lookupModuleWithSuggestions" (ppr p <+> ppr name) mod_unit = unit_lookup . moduleUnit ===================================== testsuite/tests/package/ImportReexport.hs ===================================== @@ -1,2 +1,3 @@ module ImportReexport where -import GHC.Types -- reexported by ghc-prim from ghc-internal +import GHC.Types -- reexported and renamed by ghc-prim from ghc-internal +import GHC.Platform.ArchOS -- reexported by by ghc and ghc-boot + provided by ghc-platform ===================================== testsuite/tests/package/ImportReexport.stderr ===================================== @@ -3,3 +3,10 @@ ImportReexport.hs:2:1: error: [GHC-87110] It is a member of the hidden package ‘ghc-prim-0.14.0’. Use -v to see a list of the files searched for. +ImportReexport.hs:3:1: error: [GHC-87110] + Could not load module ‘GHC.Platform.ArchOS’. + It is a member of the hidden package ‘ghc-10.1’. + It is a member of the hidden package ‘ghc-boot-10.1’. + It is a member of the hidden package ‘ghc-platform-0.1.0.0’. + Use -v to see a list of the files searched for. + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fcfa795ad8256084624302865141297a... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fcfa795ad8256084624302865141297a... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Hengel (@sol)