From 49269cdce09a38558550942ffaecbdf2cd4f03ec Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Fri, 5 Sep 2025 11:07:16 +0200 Subject: [PATCH] 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. --- compiler/GHC/Iface/Errors/Ppr.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/GHC/Iface/Errors/Ppr.hs b/compiler/GHC/Iface/Errors/Ppr.hs index d9f07343d245..7e39adf79d17 100644 --- a/compiler/GHC/Iface/Errors/Ppr.hs +++ b/compiler/GHC/Iface/Errors/Ppr.hs @@ -336,8 +336,10 @@ 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 by enabling ppr-debug. Otherwise we + -- may not have enough qualification and the printed names could look exactly + -- the same. + updSDocContext (\ctx -> ctx { sdocPprDebug = True}) $ withPprStyle (mkUserStyle alwaysQualify AllTheWay) $ -- we want the Modules below to be qualified with package names, -- so reset the NamePprCtx setting. @@ -345,7 +347,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