diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc')
13 files changed, 35 insertions, 34 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 5cbe83f274..b06ecdb859 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1640,12 +1640,9 @@ self => val point = in.offset val hasEq = in.token == EQUALS - if (hasVal && !hasEq) - syntaxError(in.offset, "val in for comprehension must be followed by assignment") - if (!hasVal && hasEq) { - deprecationWarning(in.lastOffset, "for comprehension assignment without a `val' declaration is deprecated.") - // not yet, deprecated in 2.10.0. - // syntaxError(in.offset, "assignment in for comprehension must be preceded by `val`") + if (hasVal) { + if (hasEq) deprecationWarning(in.offset, "val keyword in for comprehension is deprecated") + else syntaxError(in.offset, "val in for comprehension must be followed by assignment") } if (hasEq && eqOK) in.nextToken() diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index e3af9f52ae..724b30ef44 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -318,7 +318,7 @@ abstract class TreeBuilder { * * 3. * - * for (P_1 <- G_1; val P_2 <- G_2; ...) ... + * for (P_1 <- G_1; P_2 <- G_2; ...) ... * ==> * G_1.flatMap (P_1 => for (P_2 <- G_2; ...) ...) * @@ -330,7 +330,7 @@ abstract class TreeBuilder { * * 5. For N < MaxTupleArity: * - * for (P_1 <- G; val P_2 = E_2; val P_N = E_N; ...) + * for (P_1 <- G; P_2 = E_2; val P_N = E_N; ...) * ==> * for (TupleN(P_1, P_2, ... P_N) <- * for (x_1 @ P_1 <- G) yield { diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala index 4e02371a7e..5aa76fad83 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala @@ -224,7 +224,7 @@ trait Members { self: ICodes => val nextBlock: mutable.Map[BasicBlock, BasicBlock] = mutable.HashMap.empty for (b <- code.blocks.toList if b.successors.length == 1; - val succ = b.successors.head; + succ = b.successors.head; if succ ne b; if succ.predecessors.length == 1; if succ.predecessors.head eq b; diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala index a82e81b858..c656219dc8 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala @@ -44,7 +44,7 @@ abstract class Liveness { gen.clear() kill.clear() - for (b <- m.code.blocks; val (g, k) = genAndKill(b)) { + for (b <- m.code.blocks; (g, k) = genAndKill(b)) { gen += (b -> g) kill += (b -> k) } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala index 09718947f4..d9e0243c16 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala @@ -81,7 +81,7 @@ abstract class ReachingDefinitions { drops.clear() outStack.clear() - for (b <- m.code.blocks.toList; val (g, k) = genAndKill(b); val (d, st) = dropsAndGen(b)) { + for (b <- m.code.blocks.toList; (g, k) = genAndKill(b); (d, st) = dropsAndGen(b)) { gen += (b -> g) kill += (b -> k) drops += (b -> d) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index c0a9192c86..ab42f4176c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -421,11 +421,15 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with c.cunit.source.toString) var fieldList = List[String]() - for (f <- clasz.fields if f.symbol.hasGetter; - val g = f.symbol.getter(c.symbol); - val s = f.symbol.setter(c.symbol); - if g.isPublic && !(f.symbol.name startsWith "$")) // inserting $outer breaks the bean + for { + f <- clasz.fields + if f.symbol.hasGetter + g = f.symbol.getter(c.symbol) + s = f.symbol.setter(c.symbol) + if g.isPublic && !(f.symbol.name startsWith "$") // inserting $outer breaks the bean + } { fieldList = javaName(f.symbol) :: javaName(g) :: (if (s != NoSymbol) javaName(s) else null) :: fieldList + } val methodList = for (m <- clasz.methods if !m.symbol.isConstructor && diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala index a5361c056e..24e0dba271 100644 --- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala @@ -330,7 +330,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana /** Update the map of definitions per source file */ private def updateDefinitions(files: Set[AbstractFile]) { - for (src <- files; val localDefs = compiler.dependencyAnalysis.definitions(src)) { + for (src <- files; localDefs = compiler.dependencyAnalysis.definitions(src)) { definitions(src) = (localDefs map (s => { this.classes += s.fullName -> src SymWithHistory( diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index b516e137e8..0a5104f824 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -1064,13 +1064,12 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends for { tpe <- typeOfTerm(id) clazz <- classOfTerm(id) - val staticSym = tpe.typeSymbol + staticSym = tpe.typeSymbol runtimeSym <- safeClass(clazz.getName) if runtimeSym != staticSym if runtimeSym isSubClass staticSym - } yield { - runtimeSym.info } + yield runtimeSym.info } object replTokens extends { diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index 49b67bb29f..c3fc2732a9 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -251,7 +251,7 @@ abstract class SymbolLoaders { } } // enter decls of parent classes - for (pt <- module.info.parents; val p = pt.typeSymbol) { + for (pt <- module.info.parents; p = pt.typeSymbol) { if (p != definitions.ObjectClass && p != definitions.ScalaObjectClass) { openPackageModule(p)(packageClass) } diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index f121571d17..47fadd9fd5 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -417,7 +417,7 @@ abstract class ClassfileParser { val parts = name.decode.toString.split(Array('.', '$')) var sym: Symbol = definitions.RootClass atPhase(currentRun.flattenPhase.prev) { - for (part0 <- parts; if !(part0 == ""); val part = newTermName(part0)) { + for (part0 <- parts; if !(part0 == ""); part = newTermName(part0)) { val sym1 = atPhase(currentRun.icodePhase) { sym.linkedClassOfClass.info sym.info.decl(part.encode) diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 98d6286d02..e29f085de7 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -310,7 +310,7 @@ abstract class Constructors extends Transform with ast.TreeDSL { } log("merging: " + originalStats.mkString("\n") + "\nwith\n" + specializedStats.mkString("\n")) - val res = for (s <- originalStats; val stat = s.duplicate) yield { + val res = for (s <- originalStats; stat = s.duplicate) yield { log("merge: looking at " + stat) val stat1 = stat match { case Assign(sel @ Select(This(_), field), _) => diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 81d7e8b373..d43dfdd3d9 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -856,7 +856,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { */ def addCheckedGetters(clazz: Symbol, stats: List[Tree]): List[Tree] = { - val stats1 = for (stat <- stats; val sym = stat.symbol) yield stat match { + val stats1 = for (stat <- stats; sym = stat.symbol) yield stat match { case DefDef(mods, name, tp, vp, tpt, rhs) if sym.isLazy && rhs != EmptyTree && !clazz.isImplClass => assert(fieldOffset.isDefinedAt(sym)) 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)) |