diff options
author | michelou <michelou@epfl.ch> | 2009-02-24 11:54:40 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2009-02-24 11:54:40 +0000 |
commit | 57e95eb403c325594e17c6f84852bbdc49954fd6 (patch) | |
tree | 8822a041b7a53f08943473a2eef8685776cac1f1 /src/compiler/scala/tools/nsc | |
parent | bf35b888e49afb245883571cc00cbb5ec7341f24 (diff) | |
download | scala-57e95eb403c325594e17c6f84852bbdc49954fd6.tar.gz scala-57e95eb403c325594e17c6f84852bbdc49954fd6.tar.bz2 scala-57e95eb403c325594e17c6f84852bbdc49954fd6.zip |
removed deprecated for-loops
Diffstat (limited to 'src/compiler/scala/tools/nsc')
18 files changed, 72 insertions, 68 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index 8e8875121c..c3ad63383b 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -351,7 +351,7 @@ abstract class TreeBuilder { case Alternative(ts) => ts case _ => List(t) } - Alternative(for (val t <- ts; val a <- alternatives(t)) yield a) + Alternative(for (t <- ts; a <- alternatives(t)) yield a) } /** Create tree for a pattern sequence */ @@ -360,7 +360,7 @@ abstract class TreeBuilder { case Sequence(ts) => ts case _ => List(t) } - Sequence(for (val t <- ts; val e <- elements(t)) yield e) + Sequence(for (t <- ts; e <- elements(t)) yield e) } /** Create tree for the p+ regex pattern, becomes p p* */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala index 98f0ab7aa7..18aaddd1fe 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala @@ -213,7 +213,7 @@ trait BasicBlocks { changed = true Array.copy(instrs, 0, newInstrs, 0, i) var j = i - for (val x <- is) { + for (x <- is) { newInstrs(j) = x j += 1 } @@ -234,7 +234,7 @@ trait BasicBlocks { val newInstrs = new Array[Instruction](instrs.length + is.length); Array.copy(instrs, 0, newInstrs, 0, i) var j = i - for (val x <- is) { + for (x <- is) { newInstrs(j) = x j += 1 } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala index 2b79dbd0f1..0335c27350 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala @@ -138,11 +138,11 @@ trait Members { self: ICodes => this } - override def toString() = symbol.fullNameString; + override def toString() = symbol.fullNameString - def lookupField(s: Symbol) = fields find ((f) => f.symbol == s); - def lookupMethod(s: Symbol) = methods find ((m) => m.symbol == s); - def lookupMethod(s: Name) = methods find ((m) => m.symbol.name == s); + def lookupField(s: Symbol) = fields find (_.symbol == s) + def lookupMethod(s: Symbol) = methods find (_.symbol == s) + def lookupMethod(s: Name) = methods find (_.symbol.name == s) } /** Represent a field in ICode */ @@ -248,13 +248,13 @@ trait Members { self: ICodes => def normalize: Unit = if (this.code ne null) { import scala.collection.mutable.{Map, HashMap} val nextBlock: Map[BasicBlock, BasicBlock] = HashMap.empty - for (val b <- code.blocks.toList; - b.successors.length == 1; + for (b <- code.blocks.toList + if b.successors.length == 1; val succ = b.successors.head; - succ ne b; - succ.predecessors.length == 1; - succ.predecessors.head eq b; - !(exh.exists { (e: ExceptionHandler) => + if succ ne b; + if succ.predecessors.length == 1; + if succ.predecessors.head eq b; + if !(exh.exists { (e: ExceptionHandler) => (e.covers(succ) && !e.covers(b)) || (e.covers(b) && !e.covers(succ)) })) { nextBlock(b) = succ } 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 7de2fe4462..00ed5279db 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala @@ -104,7 +104,7 @@ abstract class ReachingDefinitions { def genAndKill(b: BasicBlock): (Set[Definition], Set[Local]) = { var genSet: Set[Definition] = new HashSet var killSet: Set[Local] = new HashSet - for (val (i, idx) <- b.toList.zipWithIndex) i match { + for ((i, idx) <- b.toList.zipWithIndex) i match { case STORE_LOCAL(local) => killSet = killSet + local genSet = updateReachingDefinition(b, idx, genSet) @@ -118,7 +118,7 @@ abstract class ReachingDefinitions { var drops = 0 var stackOut: List[Set[(BasicBlock, Int)]] = Nil - for (val (instr, idx) <- b.toList.zipWithIndex) { + for ((instr, idx) <- b.toList.zipWithIndex) { if (instr == LOAD_EXCEPTION()) () else if (instr.consumed > depth) { diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index c0a557db55..c341d28ca8 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -363,7 +363,7 @@ abstract class TypeFlowAnalysis { new TransferFunction(consumed, gens) } - for (val b <- blocks) { + for (b <- blocks) { flowFun = flowFun + (b -> transfer(b)) } } @@ -619,7 +619,7 @@ abstract class TypeFlowAnalysis { val stack = out.stack out.stack.pop(consumed) - for (val g <- gens) g match { + for (g <- gens) g match { case Bind(l, t) => out.vars += (l -> t.getKind(in)) case Push(t) => diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 985af2bef6..76aec33069 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -162,7 +162,7 @@ abstract class GenJVM extends SubComponent { parents = definitions.ObjectClass.tpe :: parents; if (!forCLDC) - for (val attr <- c.symbol.attributes) attr match { + for (attr <- c.symbol.attributes) attr match { case AnnotationInfo(tp, _, _) if tp.typeSymbol == SerializableAttr => parents = parents ::: List(definitions.SerializableClass.tpe) case AnnotationInfo(tp, _, _) if tp.typeSymbol == CloneableAttr => @@ -373,7 +373,7 @@ abstract class GenJVM extends SubComponent { buf.put('['.toByte) val arr = const.arrayValue buf.putShort(arr.length.toShort) - for (val elem <- arr) emitElement(elem) + for (elem <- arr) emitElement(elem) } var nattr = 0 @@ -584,7 +584,7 @@ abstract class GenJVM extends SubComponent { } } - for (val local <- m.locals; (! m.params.contains(local))) { + for (local <- m.locals if ! m.params.contains(local)) { if (settings.debug.value) log("add local var: " + local); jmethod.addNewLocalVariable(javaType(local.kind), javaName(local.sym)) @@ -687,7 +687,7 @@ abstract class GenJVM extends SubComponent { val paramJavaTypes = m.info.paramTypes map toTypeKind val paramNames: Array[String] = new Array[String](paramJavaTypes.length); - for (val i <- 0.until(paramJavaTypes.length)) + for (i <- 0 until paramJavaTypes.length) paramNames(i) = "x_" + i val mirrorMethod = jclass.addNewMethod(ACC_PUBLIC | ACC_FINAL | ACC_STATIC, @@ -1237,10 +1237,10 @@ abstract class GenJVM extends SubComponent { } // local vars that survived this basic block - for (val lv <- varsInBlock) { + for (lv <- varsInBlock) { lv.ranges = (lv.start, jcode.getPC()) :: lv.ranges } - for (val lv <- b.varsInScope) { + for (lv <- b.varsInScope) { lv.ranges = (labels(b).getAnchor(), jcode.getPC()) :: lv.ranges } } diff --git a/src/compiler/scala/tools/nsc/models/Models.scala b/src/compiler/scala/tools/nsc/models/Models.scala index 65658ea5dd..0790bdbe43 100644 --- a/src/compiler/scala/tools/nsc/models/Models.scala +++ b/src/compiler/scala/tools/nsc/models/Models.scala @@ -105,23 +105,23 @@ abstract class Models { tree match { case cdef: ClassDef => ret = ret + "[" + - (for (val tparam <- cdef.tparams) yield textFor(tparam)) + "]"; + (for (tparam <- cdef.tparams) yield textFor(tparam)) + "]"; cdef.mods case vdef: ValOrDefDef => vdef match { case ddef: DefDef => ret = ret + "[" + - (for (val tparam <- ddef.tparams) yield textFor(tparam)) + "]"; - for (val vparams <- ddef.vparamss) { + (for (tparam <- ddef.tparams) yield textFor(tparam)) + "]"; + for (vparams <- ddef.vparamss) { ret = ret + "(" + - (for (val vparam <- vparams) yield textFor(vparam)) + ")"; + (for (vparam <- vparams) yield textFor(vparam)) + ")"; } case _ => } ret = ret + " : " + textFor(vdef.tpt) /* Martin to Sean: Please check whether this can be dropped or does it need to be adapted? case atd: AbsTypeDef => - ret = ret + "[" + (for (val tparam <- atd.tparams) yield textFor(tparam)) + "]" + + ret = ret + "[" + (for (tparam <- atd.tparams) yield textFor(tparam)) + "]" + ((if(atd.hi ne null) " <: " + textFor(atd.hi) else "") + (if(atd.lo ne null) " >: " + textFor(atd.lo) else "")); */ @@ -203,13 +203,13 @@ abstract class Models { val marked = new HashSet[HasTree] var updated = false - for (val mmbr1 <- members1) if (mmbr1.isInstanceOf[PackageDef]) { + for (mmbr1 <- members1) if (mmbr1.isInstanceOf[PackageDef]) { Console.err.println("PACKAGE: " + mmbr1.symbol + " " + members1.length) } else if (isMember(mmbr1)) { val mmbr2 = member(mmbr1, members1) if (mmbr2 ne null) { var found = false - for (val mmbr <- members) if (!found && mmbr.replacedBy(mmbr2)) { + for (mmbr <- members) if (!found && mmbr.replacedBy(mmbr2)) { //Console.err.println("REPLACE: " + mmbr + " with " + mmbr2) mmbr.mods0 = mods1(mmbr1) found = true @@ -287,8 +287,8 @@ abstract class Models { if (super.replacedBy(tree0) && tree0.isInstanceOf[DefDef]) { val tree1 = tree0.asInstanceOf[DefDef] if (tree1.vparamss.length == treez.vparamss.length) { - val tpz = for (val vd <- treez.vparamss) yield for (val xd <- vd) yield xd.tpe; - val tp1 = for (val vd <- tree1.vparamss) yield for (val xd <- vd) yield xd.tpe; + val tpz = for (vd <- treez.vparamss) yield for (xd <- vd) yield xd.tpe; + val tp1 = for (vd <- tree1.vparamss) yield for (xd <- vd) yield xd.tpe; tpz == tp1 } else false } else false @@ -326,7 +326,7 @@ abstract class Models { val tree = ValDef(mods, ddef.name, ddef.tpt, ddef.rhs).setPos(ddef.pos).setSymbol(sym); tree :: Nil; - } else for (val member <- members; member.symbol == sym) yield member + } else for (member <- members if member.symbol == sym) yield member if (ret.isEmpty) null else ret.head } else tree @@ -383,7 +383,7 @@ abstract class Models { } def flatten0(exprs: List[Tree], filter: (Tree) => Boolean): List[Tree] = - for (val expr <- exprs; val t: Tree <- flatten(expr,filter)) yield t + for (expr <- exprs; t: Tree <- flatten(expr,filter)) yield t def flatten(expr: Tree, filter: (Tree) => Boolean): List[Tree] = if (filter(expr)) expr :: Nil; else expr match { diff --git a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala index d3d3687bf4..9a7566cd22 100644 --- a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala +++ b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala @@ -128,7 +128,7 @@ class SemanticTokens(val compiler: Global) { def setLength(length1: Int) = length0 = length1 // already gap - override def convertToGap: (Int,Actual) = (0, this) + override def convertToGap: (Int, Actual) = (0, this) } def Process(unit: CompilationUnit) = new Process(unit) @@ -136,8 +136,8 @@ class SemanticTokens(val compiler: Global) { private var doLog = true def source = unit.source - def dbg(tree : Tree) = { - def treePos : Position = if (tree ne null) tree.pos else NoPosition; + def dbg(tree: Tree) = { + def treePos: Position = if (tree ne null) tree.pos else NoPosition; ( "TREE=" + tree + (if (tree ne null) (" CLASS=" + tree.getClass()) else "") + @@ -215,10 +215,11 @@ class SemanticTokens(val compiler: Global) { // ok start building.... - def build[T <: Tree](trees : List[T]) : Unit = - for (val tree : T <- trees) build(tree) + def build[T <: Tree](trees: List[T]) { + for (tree <- trees) build(tree) + } - def build(tree0: Tree) : Unit = try { + def build(tree0: Tree): Unit = try { /* if (tree0.pos != NoPosition) */ tree0 match { case tree: ImplDef => val pos = eatKeywords(unit.source.asInstanceOf[BatchSourceFile], tree.pos.offset.get) @@ -252,7 +253,7 @@ class SemanticTokens(val compiler: Global) { val ddef = tree.asInstanceOf[DefDef]; build(ddef.tparams); - for (val l0 <- ddef.vparamss; val arg <- l0) { + for (l0 <- ddef.vparamss; arg <- l0) { val pos0 : Int = if (!unit.source.beginsWith(arg.pos.offset.get, "val ")) arg.pos.offset.get; else unit.source.skipWhitespace(arg.pos.offset.get + ("val ").length()); buildDef(arg.symbol, pos0); @@ -284,7 +285,7 @@ class SemanticTokens(val compiler: Global) { } build(tree.stats) case tree: Function => - for (val arg <- tree.vparams) if (arg.pos != NoPosition) { + for (arg <- tree.vparams if arg.pos != NoPosition) { val name = arg.name.toString().trim() val pos: Int = if (unit.source.beginsWith(arg.pos.offset.getOrElse(-1), "val ")) diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 0a66361dd8..3e3e38543d 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -2631,7 +2631,7 @@ A type's typeSymbol should never be inspected directly. val eparams = for ((tparam, i) <- tparams.zipWithIndex) yield { makeExistential("?"+i, clazz, tparam.info.bounds) } - for (val tparam <- eparams) tparam setInfo tparam.info.substSym(tparams, eparams) + for (tparam <- eparams) tparam setInfo tparam.info.substSym(tparams, eparams) eparams } diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index 26b2923a18..88c83d86ad 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -132,7 +132,7 @@ abstract class AddInterfaces extends InfoTransform { if ((ifaceDecls lookup nme.MIXIN_CONSTRUCTOR) == NoSymbol) decls enter (implClass.newMethod(implClass.pos, nme.MIXIN_CONSTRUCTOR) setInfo MethodType(List(), UnitClass.tpe)) - for (val sym <- ifaceDecls.elements) { + for (sym <- ifaceDecls.elements) { if (isInterfaceMember(sym)) { if (needsImplMethod(sym)) { val impl = sym.cloneSymbol(implClass).setInfo(sym.info).resetFlag(lateDEFERRED) @@ -265,7 +265,7 @@ abstract class AddInterfaces extends InfoTransform { def implClassDefs(trees: List[Tree]): List[Tree] = { val buf = new ListBuffer[Tree] - for (val tree <- trees) + for (tree <- trees) tree match { case ClassDef(_, _, _, impl) => if (tree.symbol.needsImplClass) @@ -288,8 +288,8 @@ abstract class AddInterfaces extends InfoTransform { Apply(Select(This(clazz), impl.primaryConstructor), List()) } val mixinConstructorCalls: List[Tree] = { - for (val mc <- clazz.mixinClasses.reverse; - mc.hasFlag(lateINTERFACE) && mc != ScalaObjectClass) + for (mc <- clazz.mixinClasses.reverse + if mc.hasFlag(lateINTERFACE) && mc != ScalaObjectClass) yield mixinConstructorCall(implClass(mc)) } (tree: @unchecked) match { diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 15cad39db3..e520778398 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -784,9 +784,9 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { } /* - for (val bc <- root.info.baseClasses.tail; val other <- bc.info.decls.toList) { + for (bc <- root.info.baseClasses.tail; other <- bc.info.decls.toList) { if (other.isTerm && !other.isConstructor && !(other hasFlag (PRIVATE | BRIDGE))) { - for (val member <- root.info.nonPrivateMember(other.name).alternatives) { + for (member <- root.info.nonPrivateMember(other.name).alternatives) { if (member != other && !(member hasFlag BRIDGE) && atPhase(phase.next)(member.tpe =:= other.tpe) && @@ -884,9 +884,9 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { (bridges, toBeRemoved) } /* - for (val bc <- site.baseClasses.tail; val other <- bc.info.decls.toList) { + for (bc <- site.baseClasses.tail; other <- bc.info.decls.toList) { if (other.isMethod && !other.isConstructor) { - for (val member <- site.nonPrivateMember(other.name).alternatives) { + for (member <- site.nonPrivateMember(other.name).alternatives) { if (member != other && !(member hasFlag DEFERRED) && (site.memberType(member) matches site.memberType(other)) && diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 9c59f1936a..b7f904fbbd 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -131,7 +131,7 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter } } if (!clazz.isTrait && !parents.isEmpty) { - for (val mc <- clazz.mixinClasses) { + for (mc <- clazz.mixinClasses) { val mixinOuterAcc: Symbol = atPhase(phase.next)(outerAccessor(mc)) if (mixinOuterAcc != NoSymbol) { if (decls1 eq decls) decls1 = newScope(decls.toList) @@ -354,7 +354,7 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter newDefs += outerAccessorDef // (1) } if (!currentClass.isTrait) - for (val mc <- currentClass.mixinClasses) + for (mc <- currentClass.mixinClasses) if (outerAccessor(mc) != NoSymbol) newDefs += mixinOuterAccessorDef(mc) } diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index 3a086942c4..e08d5bd190 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -46,7 +46,7 @@ abstract class Flatten extends InfoTransform { val oldowner = clazz.owner atPhase(phase.next)(oldowner.info) parents1 = List.mapConserve(parents)(this) - for (val sym <- decls.toList) { + for (sym <- decls.toList) { if (sym.isTerm && !sym.isStaticModule) { decls1 enter sym if (sym.isModule) sym.moduleClass setFlag LIFTED diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index 321d010258..8d9069ca7b 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -406,6 +406,9 @@ abstract class LambdaLift extends InfoTransform { stat, mods, name, tparams, copy.Template(impl, parents, self, body ::: lifted)) liftedDefs -= stat.symbol result + case DefDef(mods, name, tp, vp, tpt, Block(Nil, expr)) + if !stat.symbol.isConstructor => + copy.DefDef(stat, mods, name, tp, vp, tpt, expr) case _ => stat } diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index e1a2e2f916..16f710a481 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -185,7 +185,7 @@ abstract class Mixin extends InfoTransform { val impl = implClass(clazz) assert(impl != NoSymbol) - for (val member <- impl.info.decls.toList) { + for (member <- impl.info.decls.toList) { if (!member.isMethod && !member.isModule && !member.isModuleVar) { assert(member.isTerm && !member.isDeferred, member) if (member.getter(impl) hasFlag PRIVATE) { @@ -232,7 +232,7 @@ abstract class Mixin extends InfoTransform { /** Mix in members of implementation class mixinClass into class clazz */ def mixinImplClassMembers(impl: Symbol, iface: Symbol) { assert (impl.isImplClass) - for (val member <- impl.info.decls.toList) { + for (member <- impl.info.decls.toList) { if (isForwarded(member)) { val imember = member.overriddenSymbol(iface) //Console.println("mixin member "+member+":"+member.tpe+member.locationString+" "+imember+" "+imember.overridingSymbol(clazz)+" to "+clazz+" with scope "+clazz.info.decls)//DEBUG @@ -253,7 +253,7 @@ abstract class Mixin extends InfoTransform { */ def mixinTraitMembers(mixinClass: Symbol) { // For all members of a trait's interface do: - for (val member <- mixinClass.info.decls.toList) { + for (member <- mixinClass.info.decls.toList) { if (isConcreteAccessor(member)) { if (isOverriddenAccessor(member, clazz.info.baseClasses)) { if (settings.debug.value) println("!!! is overridden val: "+member) @@ -303,7 +303,7 @@ abstract class Mixin extends InfoTransform { } } - for (val mc <- clazz.mixinClasses) + for (mc <- clazz.mixinClasses) if (mc hasFlag lateINTERFACE) { // @SEAN: adding trait tracking so we don't have to recompile transitive closures unit.depends += mc @@ -758,7 +758,7 @@ abstract class Mixin extends InfoTransform { */ def buildFieldPositions(clazz: Symbol) { var fields = usedBits(clazz) - for (val f <- clazz.info.decls.elements if needsInitFlag(f) || f.hasFlag(LAZY)) { + for (f <- clazz.info.decls.elements if needsInitFlag(f) || f.hasFlag(LAZY)) { if (settings.debug.value) log(f.fullNameString + " -> " + fields) fieldOffset(f) = fields fields += 1 @@ -770,7 +770,7 @@ abstract class Mixin extends InfoTransform { var stats1 = addCheckedGetters(clazz, stats) // for all symbols `sym' in the class definition, which are mixed in: - for (val sym <- clazz.info.decls.toList) { + for (sym <- clazz.info.decls.toList) { if (sym hasFlag MIXEDIN) { if (clazz hasFlag lateINTERFACE) { // if current class is a trait interface, add an abstract method for accessor `sym' diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index e43ddddea9..117e6a79e7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -420,7 +420,7 @@ trait Namers { self: Analyzer => tp match { case TypeBounds(lo, hi) => // check that lower bound is not an F-bound - for (val t <- lo) { + for (t <- lo) { t match { case TypeRef(_, sym, _) => sym.initialize case _ => diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 4c2ae0c53e..6ed26ad128 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -308,7 +308,7 @@ abstract class RefChecks extends InfoTransform { val tp2 = erasure.erasure(clazz.thisType.memberType(other)) atPhase(currentRun.erasurePhase.next)(tp1 matches tp2) }) - for (val member <- clazz.tpe.nonPrivateMembers) + for (member <- clazz.tpe.nonPrivateMembers) if (member.isDeferred && !(clazz hasFlag ABSTRACT) && !isAbstractTypeWithoutFBound(member) && !((member hasFlag JAVA) && javaErasedOverridingSym(member) != NoSymbol)) { @@ -331,7 +331,7 @@ abstract class RefChecks extends InfoTransform { // // (3) is violated but not (2). def checkNoAbstractDecls(bc: Symbol) { - for (val decl <- bc.info.decls.elements) { + for (decl <- bc.info.decls.elements) { if (decl.isDeferred && !isAbstractTypeWithoutFBound(decl)) { val impl = decl.matchingSymbol(clazz.thisType) if (impl == NoSymbol || (decl.owner isSubClass impl.owner)) { @@ -348,12 +348,12 @@ abstract class RefChecks extends InfoTransform { } // 4. Check that every defined member with an `override' modifier overrides some other member. - for (val member <- clazz.info.decls.toList) + for (member <- clazz.info.decls.toList) if ((member hasFlag (OVERRIDE | ABSOVERRIDE)) && (clazz.info.baseClasses.tail forall { bc => member.matchingSymbol(bc, clazz.thisType) == NoSymbol })) { - // for (val bc <- clazz.info.baseClasses.tail) Console.println("" + bc + " has " + bc.info.decl(member.name) + ":" + bc.info.decl(member.name).tpe);//DEBUG + // for (bc <- clazz.info.baseClasses.tail) Console.println("" + bc + " has " + bc.info.decl(member.name) + ":" + bc.info.decl(member.name).tpe);//DEBUG unit.error(member.pos, member.toString() + " overrides nothing"); member resetFlag OVERRIDE } @@ -544,7 +544,7 @@ abstract class RefChecks extends InfoTransform { private def enterSyms(stats: List[Tree]) { var index = -1 - for (val stat <- stats) { + for (stat <- stats) { index = index + 1; stat match { case ClassDef(_, _, _, _) | DefDef(_, _, _, _, _, _) | ModuleDef(_, _, _) | ValDef(_, _, _, _) => diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index e3e29ce75f..c9d5a2ad2d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -132,7 +132,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT case ClassDef(_, _, _, _) => checkCompanionNameClashes(tree.symbol) val decls = tree.symbol.info.decls - for (val sym <- decls.toList) { + for (sym <- decls.toList) { if (sym.privateWithin.isClass && !sym.privateWithin.isModuleClass && !sym.hasFlag(EXPANDEDNAME) && !sym.isConstructor) { decls.unlink(sym) |