Skip to content
Snippets Groups Projects
Commit 2a68b8b7 authored by Alex D's avatar Alex D :mushroom: Committed by Marge Bot
Browse files

Fix #16805 by formatting warning message

parent d35cec7a
No related branches found
No related tags found
No related merge requests found
......@@ -302,12 +302,10 @@ warnUnusedPackages = do
let warn = makeIntoWarning
(Reason Opt_WarnUnusedPackages)
(mkPlainErrMsg dflags noSrcSpan msg)
msg = hang
( text "The following packages were specified "
<> text "via -package or -package-id flags, "
<> text "but were not needed for compilation: ")
4
(sep (map pprUnusedArg unusedArgs))
msg = vcat [ text "The following packages were specified" <+>
text "via -package or -package-id flags,"
, text "but were not needed for compilation:"
, nest 2 (vcat (map (withDash . pprUnusedArg) unusedArgs)) ]
when (wopt Opt_WarnUnusedPackages dflags && not (null unusedArgs)) $
logWarnings (listToBag [warn])
......@@ -319,6 +317,8 @@ warnUnusedPackages = do
pprUnusedArg (PackageArg str) = text str
pprUnusedArg (UnitIdArg uid) = ppr uid
withDash = (<+>) (text "-")
matchingStr :: String -> PackageConfig -> Bool
matchingStr str p
= str == sourcePackageIdString p
......
......@@ -2,5 +2,8 @@
Linking UnusedPackages ...
<no location info>: warning: [-Wunused-packages]
The following packages were specified via -package or -package-id flags, but were not needed for compilation:
bytestring
The following packages were specified via -package or -package-id flags,
but were not needed for compilation:
- ghc
- process
- bytestring
......@@ -28,4 +28,5 @@ test('StarBinder', normal, compile, [''])
test('Overflow', expect_broken_for(16543, ['hpc']), compile, [''])
test('UnusedPackages', normal, multimod_compile, ['UnusedPackages.hs', '-package=bytestring -package=base -Wunused-packages'])
test('UnusedPackages', normal, multimod_compile,
['UnusedPackages.hs', '-package=bytestring -package=base -package=process -package=ghc -Wunused-packages'])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment