Skip to content

Commit 5a08e30

Browse files
committed
Show the number, change the wording
1 parent 7fde22a commit 5a08e30

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ import Text.PrettyPrint
177177
, char
178178
, colon
179179
, hsep
180+
, int
180181
, nest
182+
, parens
181183
, quotes
182184
, renderStyle
183185
, text
@@ -899,10 +901,11 @@ configurePackage cfg lbc0 pkg_descr00 flags enabled comp platform programDb0 pac
899901
(merged, ds@(dup : _)) ->
900902
noticeDoc verbosity $
901903
vcat
902-
[ (text "The build tool" <+> quotes (text $ nameOf dup) <+> "has multiple versions specified") <> colon
903-
, nest 2 $ vcat [char '-' <+> text (prettyShow $ versionOf d) | d <- ds]
904-
, text "These versions have been combined as" <> colon
905-
, nest 2 $ quotes (text $ prettyShow merged)
904+
[ (text "As the build tool" <+> quotes (text $ nameOf dup) <+> "was specified more than once") <> colon
905+
, nest 2 $ vcat [char '-' <+> versionOfDoc d | d <- ds]
906+
, (text "We'll use the effective intersection of these" <+> int (length ds) <+> "version ranges") <> colon
907+
, nest 2 $ char '-' <+> versionOfDoc merged
908+
, text "Please specify build tool dependencies only once."
906909
]
907910

908911
programDb1 <-
@@ -960,6 +963,12 @@ nameOf (LegacyExeDependency n _) = n
960963
versionOf :: LegacyExeDependency -> VersionRange
961964
versionOf (LegacyExeDependency _ v) = v
962965

966+
versionOfDoc :: LegacyExeDependency -> Doc
967+
versionOfDoc (LegacyExeDependency _ v) =
968+
if v == anyVersion
969+
then text (prettyShow v) <+> parens (text "any version")
970+
else text $ prettyShow v
971+
963972
-- | Any duplicates in the list has their version range merged by intersection.
964973
-- The second list has the build tool with its merged version range and its list
965974
-- of duplicates.

0 commit comments

Comments
 (0)