Skip to content

Commit 6a704fe

Browse files
committed
String options after settings with colon shouldn't be ignored
Format of some of the compiler settings was incompatible with scalac. For example "-target:jvm-1.8" is a valid argument for scalac, but it should be "-target: jvm-1.8" (with a whitespace) for dotc. This commit make both ways to work.
1 parent 16f0bea commit 6a704fe

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/dotty/tools/dotc/config/Settings.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,15 @@ object Settings {
115115
case (ListTag, _) =>
116116
if (argRest.isEmpty) missingArg
117117
else update((argRest split ",").toList, args)
118-
case (StringTag, arg2 :: args2) =>
119-
if (choices.nonEmpty && !(choices contains arg2))
120-
fail(s"$arg2 is not a valid choice for $name", args2)
121-
else
122-
update(arg2, args2)
118+
case (StringTag, _) =>
119+
if (argRest.isEmpty && args.isEmpty) missingArg
120+
else {
121+
val (arg, tail) = if (argRest.isEmpty) (args.head, args.tail) else (argRest, args)
122+
if (choices.nonEmpty && !(choices contains arg))
123+
fail(s"$arg is not a valid choice for $name", tail)
124+
else
125+
update(arg, tail)
126+
}
123127
case (IntTag, arg2 :: args2) =>
124128
try {
125129
val x = arg2.toInt

0 commit comments

Comments
 (0)