Skip to content

Commit e70d0ca

Browse files
committed
Show the number, change the wording
1 parent 72da2aa commit e70d0ca

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
@@ -175,7 +175,9 @@ import Text.PrettyPrint
175175
, char
176176
, colon
177177
, hsep
178+
, int
178179
, nest
180+
, parens
179181
, quotes
180182
, renderStyle
181183
, text
@@ -897,10 +899,11 @@ configurePackage cfg lbc0 pkg_descr00 flags enabled comp platform programDb0 pac
897899
(merged, ds@(dup : _)) ->
898900
noticeDoc verbosity $
899901
vcat
900-
[ (text "The build tool" <+> quotes (text $ nameOf dup) <+> "has multiple versions specified") <> colon
901-
, nest 2 $ vcat [char '-' <+> text (prettyShow $ versionOf d) | d <- ds]
902-
, text "These versions have been combined as" <> colon
903-
, nest 2 $ quotes (text $ prettyShow merged)
902+
[ (text "As the build tool" <+> quotes (text $ nameOf dup) <+> "was specified more than once") <> colon
903+
, nest 2 $ vcat [char '-' <+> versionOfDoc d | d <- ds]
904+
, (text "We'll use the effective intersection of these" <+> int (length ds) <+> "version ranges") <> colon
905+
, nest 2 $ char '-' <+> versionOfDoc merged
906+
, text "Please specify build tool dependencies only once."
904907
]
905908

906909
programDb1 <-
@@ -958,6 +961,12 @@ nameOf (LegacyExeDependency n _) = n
958961
versionOf :: LegacyExeDependency -> VersionRange
959962
versionOf (LegacyExeDependency _ v) = v
960963

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

0 commit comments

Comments
 (0)