From 91670d91824493e8bbbd88e9861e04e710311cbb Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Sat, 24 May 2014 01:31:20 -0700 Subject: SI-8616 Error on -deprecation:true,false This is an error, not a crash. Alternatively, one could define the multivalued colon case as equivalent to specifying the option multiple times. That would be very regular. But sometimes it's nicer just to error out. --- src/compiler/scala/tools/nsc/settings/MutableSettings.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala index 5b5c80c514..b399c0e024 100644 --- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala @@ -444,7 +444,7 @@ class MutableSettings(val errorFn: String => Unit) value = s.equalsIgnoreCase("true") } override def tryToSetColon(args: List[String]) = args match { - case Nil => tryToSet(Nil) + case Nil => tryToSet(Nil) case List(x) => if (x.equalsIgnoreCase("true")) { value = true @@ -452,7 +452,8 @@ class MutableSettings(val errorFn: String => Unit) } else if (x.equalsIgnoreCase("false")) { value = false Some(Nil) - } else errorAndValue("'" + x + "' is not a valid choice for '" + name + "'", None) + } else errorAndValue(s"'$x' is not a valid choice for '$name'", None) + case _ => errorAndValue(s"'$name' accepts only one boolean value", None) } } -- cgit v1.2.3