Skip to content

Commit 1ad15b1

Browse files
committed
Discard empty strings in option position, but n...
Discard empty strings in option position, but not in argument position. Closes SI-4782, no review.
1 parent 9f9af2a commit 1ad15b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/compiler/scala/tools/nsc/settings/MutableSettings.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ class MutableSettings(val errorFn: String => Unit)
5353
errorFn("bad option: '" + x + "'")
5454
(false, args)
5555
}
56+
// discard empties, sometimes they appear because of ant or etc.
57+
// but discard carefully, because an empty string is valid as an argument
58+
// to an option, e.g. -cp "" . So we discard them only when they appear
59+
// in option position.
60+
else if (x == "") {
61+
loop(xs, residualArgs)
62+
}
5663
else lookupSetting(x) match {
5764
case Some(s) if s.shouldStopProcessing => (checkDependencies, newArgs)
5865
case _ => loop(newArgs, residualArgs)
@@ -63,7 +70,7 @@ class MutableSettings(val errorFn: String => Unit)
6370
else (checkDependencies, args)
6471
}
6572
}
66-
loop(arguments filterNot (_ == ""), Nil)
73+
loop(arguments, Nil)
6774
}
6875
def processArgumentString(params: String) = processArguments(splitParams(params), true)
6976

0 commit comments

Comments
 (0)