[Git][ghc/ghc][master] Print fully qualified unit names in name mismatch
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 54b5950e by Sylvain Henry at 2025-09-17T04:45:18-04:00 Print fully qualified unit names in name mismatch It's more user-friendly to directly print the right thing instead of requiring the user to retry with the additional `-dppr-debug` flag. - - - - - 2 changed files: - compiler/GHC/Iface/Errors/Ppr.hs - compiler/GHC/Unit/State.hs Changes: ===================================== compiler/GHC/Iface/Errors/Ppr.hs ===================================== @@ -336,8 +336,9 @@ hiModuleNameMismatchWarn requested_mod read_mod ] ] | otherwise = - -- ToDo: This will fail to have enough qualification when the package IDs - -- are the same + -- Display fully qualified unit names. Otherwise we may not have enough + -- qualification and the printed names could look exactly the same. + pprRawUnitIds $ withPprStyle (mkUserStyle alwaysQualify AllTheWay) $ -- we want the Modules below to be qualified with package names, -- so reset the NamePprCtx setting. @@ -345,7 +346,6 @@ hiModuleNameMismatchWarn requested_mod read_mod , ppr requested_mod , text "differs from name found in the interface file" , ppr read_mod - , parens (text "if these names look the same, try again with -dppr-debug") ] dynamicHashMismatchError :: Module -> ModLocation -> SDoc ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -66,6 +66,7 @@ module GHC.Unit.State ( pprUnitInfoForUser, pprModuleMap, pprWithUnitState, + pprRawUnitIds, -- * Utils unwireUnit) @@ -2269,3 +2270,7 @@ pprWithUnitState :: UnitState -> SDoc -> SDoc pprWithUnitState state = updSDocContext (\ctx -> ctx { sdocUnitIdForUser = \fs -> pprUnitIdForUser state (UnitId fs) }) + +-- | Print raw unit-ids, without removing the hash +pprRawUnitIds :: SDoc -> SDoc +pprRawUnitIds = updSDocContext (\ctx -> ctx { sdocUnitIdForUser = ftext }) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/54b5950ebfed24429fae5111896ffc1f... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/54b5950ebfed24429fae5111896ffc1f... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)