diff options
author | Paul Phillips <paulp@improving.org> | 2011-08-10 00:55:15 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-08-10 00:55:15 +0000 |
commit | 879e5af47db2ae6807aef26dd786e6ea920ac554 (patch) | |
tree | 7aecb05e2c9361689c16dec2a2c8473af6d0b4fd /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | |
parent | e3e64e43659f53dd8f9cd5837f78a7e4378dc4c4 (diff) | |
download | scala-879e5af47db2ae6807aef26dd786e6ea920ac554.tar.gz scala-879e5af47db2ae6807aef26dd786e6ea920ac554.tar.bz2 scala-879e5af47db2ae6807aef26dd786e6ea920ac554.zip |
Reversed the values of "is" and "is not" in rec...
Reversed the values of "is" and "is not" in recent for comprehension
deprecation.
DO NOT BLOW HATCH
REPEAT
DO NOT BLOW HATCH
"Roger! Hatch blown."
Events reveal it was all baby, no bathwater. It turns out that the
specification is merely a document, not infallible holy writ as we
had all previously believed. So it is not the ABSENCE of val in a for
comprehension assignment which is deprecated, it is the PRESENCE of val.
Summarizing again, more accurately perhaps:
for (x <- 1 to 5 ; y = x) yield x+y // THAT's the one
for (val x <- 1 to 5 ; y = x) yield x+y // fail
for (val x <- 1 to 5 ; val y = x) yield x+y // fail
for (x <- 1 to 5 ; val y = x) yield x+y // deprecated
No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index f4a7ad678a..478e20dde8 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1512,7 +1512,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val (oldtparams, newtparams) = reskolemize(tparams) // create fresh symbols for value parameters to hold the skolem types - val vparamss1 = List(for (vdef <- vparamss.head; val param = vdef.symbol) yield { + val vparamss1 = List(for (vdef <- vparamss.head; param = vdef.symbol) yield { ValDef(param.cloneSymbol(symbol).setInfo(param.info.substSym(oldtparams, newtparams))) }) @@ -1551,20 +1551,21 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if (info(m).target.hasAccessorFlag) hasSpecializedFields = true if (m.isClassConstructor) { val origParamss = parameters(info(m).target) - - val vparams = - for ((tp, sym) <- m.info.paramTypes zip origParamss(0)) - yield m.newValue(sym.pos, specializedName(sym, typeEnv(cls))) - .setInfo(tp) - .setFlag(sym.flags) - + val vparams = ( + for ((tp, sym) <- m.info.paramTypes zip origParamss(0)) yield ( + m.newValue(sym.pos, specializedName(sym, typeEnv(cls))) + .setInfo(tp) + .setFlag(sym.flags) + ) + ) // param accessors for private members (the others are inherited from the generic class) - if (m.isPrimaryConstructor) - for (param <- vparams if cls.info.nonPrivateMember(param.name) == NoSymbol; - val acc = param.cloneSymbol(cls).setFlag(PARAMACCESSOR | PRIVATE)) { + if (m.isPrimaryConstructor) { + for (param <- vparams ; if cls.info.nonPrivateMember(param.name) == NoSymbol) { + val acc = param.cloneSymbol(cls).setFlag(PARAMACCESSOR | PRIVATE) cls.info.decls.enter(acc) mbrs += ValDef(acc, EmptyTree).setType(NoType).setPos(m.pos) } + } // ctor mbrs += atPos(m.pos)(DefDef(m, Modifiers(m.flags), List(vparams) map (_ map ValDef), EmptyTree)) |