diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-09 19:24:48 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-09 19:24:48 +0000 |
commit | bc4468cdd266fc12fe164c1b6ec4da94b71a4129 (patch) | |
tree | 4daa2b1a82c17daf9c2f901de953d2fa82ddebe4 /src/compiler | |
parent | 2c1a1192ce19f84984eb52037fba5b26794ed3fa (diff) | |
download | scala-bc4468cdd266fc12fe164c1b6ec4da94b71a4129.tar.gz scala-bc4468cdd266fc12fe164c1b6ec4da94b71a4129.tar.bz2 scala-bc4468cdd266fc12fe164c1b6ec4da94b71a4129.zip |
Flipped varargs eta-expansion behavior.
(T*)U now eta-expands to Seq[T] => U, not T* => U. There is a transition
command line switch to get the old behavior for any who may have relied
upon it:
-Yeta-expand-keeps-star
Closes SI-4176, no review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/reflect/internal/Types.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index c313f079ae..1e0a265f4b 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -3092,7 +3092,7 @@ A type's typeSymbol should never be inspected directly. // Or false for Seq[A] => Seq[A] // (It will rewrite A* everywhere but method parameters.) // This is the specified behavior. - private final val etaExpandKeepsStar = true + protected def etaExpandKeepsStar = false object dropRepeatedParamType extends TypeMap { def apply(tp: Type): Type = tp match { diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 604379d33f..e166b42436 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -300,6 +300,12 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb def lubDebug = (sys.props contains "scalac.debug.lub") } + // The current division between scala.reflect.* and scala.tools.nsc.* is pretty + // clunky. It is often difficult to have a setting influence something without having + // to create it on that side. For this one my strategy is a constant def at the file + // where I need it, and then an override in Global with the setting. + override protected val etaExpandKeepsStar = settings.etaExpandKeepsStar.value + // True if -Xscript has been set, indicating a script run. def isScriptRun = opt.script.isDefined diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 10ba5b200a..5cf5767257 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -168,6 +168,7 @@ trait ScalaSettings extends AbsScalaSettings val Ynotnull = BooleanSetting ("-Ynotnull", "Enable (experimental and incomplete) scala.NotNull.") val YdepMethTpes = BooleanSetting ("-Ydependent-method-types", "Allow dependent method types.") val YmethodInfer = BooleanSetting ("-Yinfer-argument-types", "Infer types for arguments of overriden methods.") + val etaExpandKeepsStar = BooleanSetting("-Yeta-expand-keeps-star", "Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.") val noSelfCheck = BooleanSetting ("-Yno-self-type-checks", "Suppress check for self-type conformance among inherited members.") val YvirtClasses = false // too embryonic to even expose as a -Y //BooleanSetting ("-Yvirtual-classes", "Support virtual classes") |