diff options
author | Paul Phillips <paulp@improving.org> | 2012-08-06 14:09:59 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-08-06 14:09:59 -0700 |
commit | 963aabbeb45e042f4b0d6f5ec13edb0136cbf441 (patch) | |
tree | 0afe1b93e90088dd35c426c56f559a8116342cfe /src/compiler | |
parent | b65b7b13924a86d38e04873f9c68d69590dec661 (diff) | |
download | scala-963aabbeb45e042f4b0d6f5ec13edb0136cbf441.tar.gz scala-963aabbeb45e042f4b0d6f5ec13edb0136cbf441.tar.bz2 scala-963aabbeb45e042f4b0d6f5ec13edb0136cbf441.zip |
Fix for SI-4945, repl hang on -i input.
Other breakage had accumulated among Settings. I determined
that once upon a time, "MultiStringSetting" accepted arguments
like this:
scala -foo bip bop bar
Somewhere this was changed to force a : argument, like
scala -foo:bip,bop,bar
This incurs breakage. The repl has always advertised its -i
option without a colon and it has always been a MultiStringSetting.
Forcing everything into the : seemed like the wrong thing,
especially because it will stomp on any whitespace containing
arguments, whereas in the original form
scala -foo bip "bop bar" baz
will yield its arguments as given.
So lacking any good ideas and knowing something probably depends
on each way already, I made it work both ways.
Diffstat (limited to 'src/compiler')
3 files changed, 10 insertions, 6 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Settings.scala b/src/compiler/scala/reflect/macros/runtime/Settings.scala index b7dba665fa..9c24273cd7 100644 --- a/src/compiler/scala/reflect/macros/runtime/Settings.scala +++ b/src/compiler/scala/reflect/macros/runtime/Settings.scala @@ -5,9 +5,9 @@ trait Settings { self: Context => def settings: List[String] = { - val optionName = universe.settings.XmacroSettings.name - val settings = compilerSettings.find(opt => opt.startsWith(optionName)).map(opt => opt.substring(optionName.length + 1)).getOrElse("") - settings.split(",").toList + val us = universe.settings + import us._ + userSetSettings collectFirst { case x: MultiStringSetting if x.name == XmacroSettings.name => x.value } getOrElse Nil } def compilerSettings: List[String] = universe.settings.recreateArgs @@ -33,4 +33,4 @@ trait Settings { try op finally setCompilerSettings(old) } -}
\ No newline at end of file +} diff --git a/src/compiler/scala/tools/nsc/MainGenericRunner.scala b/src/compiler/scala/tools/nsc/MainGenericRunner.scala index cc1139f8a7..f1c3e80b83 100644 --- a/src/compiler/scala/tools/nsc/MainGenericRunner.scala +++ b/src/compiler/scala/tools/nsc/MainGenericRunner.scala @@ -58,6 +58,10 @@ class MainGenericRunner { def isI = !settings.loadfiles.isDefault def dashi = settings.loadfiles.value + // Deadlocks on startup under -i unless we disable async. + if (isI) + settings.Yreplsync.value = true + def combinedCode = { val files = if (isI) dashi map (file => File(file).slurp()) else Nil val str = if (isE) List(dashe) else Nil diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala index fc833e2c26..7f627f7904 100644 --- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala @@ -68,7 +68,7 @@ class MutableSettings(val errorFn: String => Unit) if (isOpt) { val newArgs = parseParams(args) if (args eq newArgs) { - errorFn("bad option: '" + x + "'") + errorFn(s"bad option: '$x'") (false, args) } // discard empties, sometimes they appear because of ant or etc. @@ -536,7 +536,7 @@ class MutableSettings(val errorFn: String => Unit) } override def tryToSetColon(args: List[String]) = tryToSet(args) override def tryToSetFromPropertyValue(s: String) = tryToSet(s.trim.split(',').toList) - def unparse: List[String] = value map { name + ":" + _ } + def unparse: List[String] = name :: value withHelpSyntax(name + ":<" + arg + ">") } |