Skip to content

Commit 145c5e2

Browse files
committed
argument for compiler setting with colon should follow without whitespace
1 parent 6a704fe commit 145c5e2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ object Settings {
109109
ArgsSummary(sstate, args, errors :+ msg)
110110
def missingArg =
111111
fail(s"missing argument for option $name", args)
112-
def doSet(argRest: String) = ((implicitly[ClassTag[T]], args): @unchecked) match {
112+
def doSet(argRest: String = "") = ((implicitly[ClassTag[T]], args): @unchecked) match {
113113
case (BooleanTag, _) =>
114114
update(true, args)
115115
case (ListTag, _) =>
@@ -146,10 +146,16 @@ object Settings {
146146
missingArg
147147
}
148148

149-
if (prefix != "" && arg.startsWith(prefix))
150-
doSet(arg drop prefix.length)
151-
else if (prefix == "" && name == arg.takeWhile(_ != ':'))
152-
doSet(arg.dropWhile(_ != ':').drop(1))
149+
if (prefix != "")
150+
if (arg.startsWith(prefix)) doSet(arg.drop(prefix.length))
151+
else state
152+
else if (arg.contains(':') && name == arg.takeWhile(_ != ':')) {
153+
val value = arg.dropWhile(_ != ':').drop(1)
154+
if (value.isEmpty) missingArg
155+
else doSet(value)
156+
}
157+
else if (name == arg)
158+
doSet()
153159
else
154160
state
155161
}

0 commit comments

Comments
 (0)