From 22608da738a56936d185d71e447b0fd274a8f454 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 22 Aug 2009 18:48:25 +0000 Subject: Deprecation patrol. --- src/compiler/scala/tools/nsc/PhaseAssembly.scala | 4 ++-- .../scala/tools/nsc/dependencies/Changes.scala | 4 ++-- src/compiler/scala/tools/nsc/io/PlainFile.scala | 2 +- src/compiler/scala/tools/nsc/symtab/Types.scala | 20 ++++++++-------- .../scala/tools/nsc/transform/Flatten.scala | 2 +- .../scala/tools/nsc/transform/LambdaLift.scala | 2 +- .../scala/tools/nsc/transform/UnCurry.scala | 2 +- .../scala/tools/nsc/typechecker/EtaExpansion.scala | 2 +- .../scala/tools/nsc/typechecker/Implicits.scala | 2 +- .../scala/tools/nsc/typechecker/Infer.scala | 2 +- .../scala/tools/nsc/typechecker/Namers.scala | 4 ++-- .../scala/tools/nsc/typechecker/Typers.scala | 28 +++++++++++----------- 12 files changed, 37 insertions(+), 37 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/PhaseAssembly.scala b/src/compiler/scala/tools/nsc/PhaseAssembly.scala index f2abe0ca21..0679990a9b 100644 --- a/src/compiler/scala/tools/nsc/PhaseAssembly.scala +++ b/src/compiler/scala/tools/nsc/PhaseAssembly.scala @@ -170,7 +170,7 @@ trait PhaseAssembly { self: Global => if (sanity.length == 0) { throw new FatalError("There is no runs right after dependency, where there should be one! This is not supposed to happen!") } else if (sanity.length > 1) { - var msg = "Multiple phases want to run right after the phase " + sanity.first.to.phasename + "\n" + var msg = "Multiple phases want to run right after the phase " + sanity.head.to.phasename + "\n" msg += "Phases: " sanity = sanity.sort((e1,e2) => (e1.frm.phasename compareTo e2.frm.phasename) < 0) for (edge <- sanity) { @@ -308,7 +308,7 @@ trait PhaseAssembly { self: Global => sbuf.append("digraph G {\n") for (edge <- graph.edges) { sbuf.append("\"" + edge.frm.allPhaseNames + "(" + edge.frm.level + ")" + "\"->\"" + edge.to.allPhaseNames + "(" + edge.to.level + ")" + "\"") - if (! edge.frm.phaseobj.get.first.internal) { + if (! edge.frm.phaseobj.get.head.internal) { extnodes += edge.frm } edge.frm.phaseobj match { case None => null case Some(ln) => if(ln.size > 1) fatnodes += edge.frm } diff --git a/src/compiler/scala/tools/nsc/dependencies/Changes.scala b/src/compiler/scala/tools/nsc/dependencies/Changes.scala index 302f1b2b8e..6ebf6f8fa6 100644 --- a/src/compiler/scala/tools/nsc/dependencies/Changes.scala +++ b/src/compiler/scala/tools/nsc/dependencies/Changes.scala @@ -153,9 +153,9 @@ abstract class Changes { // new members not yet visited val newMembers = mutable.HashSet[Symbol]() - newMembers ++= to.info.decls.elements + newMembers ++= to.info.decls.iterator - for (o <- from.info.decls.elements; + for (o <- from.info.decls.iterator; val n = to.info.decl(o.name)) { newMembers -= n diff --git a/src/compiler/scala/tools/nsc/io/PlainFile.scala b/src/compiler/scala/tools/nsc/io/PlainFile.scala index 23082f92fb..0394a16a93 100644 --- a/src/compiler/scala/tools/nsc/io/PlainFile.scala +++ b/src/compiler/scala/tools/nsc/io/PlainFile.scala @@ -96,7 +96,7 @@ class PlainFile(val file: File) extends AbstractFile { def delete { if (file.isFile) file.delete else if (file.isDirectory) { - elements.foreach(_.delete) + iterator.foreach(_.delete) file.delete } } diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index f0158ee722..aa1b74080a 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -2472,14 +2472,14 @@ A type's typeSymbol should never be inspected directly. if (bounds1 eq bounds) tp else BoundedWildcardType(bounds1.asInstanceOf[TypeBounds]) case rtp @ RefinedType(parents, decls) => - val parents1 = List.mapConserve(parents)(this) + val parents1 = parents mapConserve (this) val decls1 = mapOver(decls) //if ((parents1 eq parents) && (decls1 eq decls)) tp //else refinementOfClass(tp.typeSymbol, parents1, decls1) copyRefinedType(rtp, parents1, decls1) /* case ClassInfoType(parents, decls, clazz) => - val parents1 = List.mapConserve(parents)(this); + val parents1 = parents mapConserve (this); val decls1 = mapOver(decls); if ((parents1 eq parents) && (decls1 eq decls)) tp else cloneDecls(ClassInfoType(parents1, new Scope(), clazz), tp, decls1) @@ -2510,7 +2510,7 @@ A type's typeSymbol should never be inspected directly. else OverloadedType(pre1, alts) case AntiPolyType(pre, args) => val pre1 = this(pre) - val args1 = List.mapConserve(args)(this) + val args1 = args mapConserve (this) if ((pre1 eq pre) && (args1 eq args)) tp else AntiPolyType(pre1, args1) case TypeVar(_, constr) => @@ -2562,7 +2562,7 @@ A type's typeSymbol should never be inspected directly. else { // map is not the identity --> do cloning properly val clonedSyms = origSyms map (_.cloneSymbol) val clonedInfos = clonedSyms map (_.info.substSym(origSyms, clonedSyms)) - val transformedInfos = List.mapConserve(clonedInfos)(this) + val transformedInfos = clonedInfos mapConserve (this) List.map2(clonedSyms, transformedInfos) { ((newSym, newInfo) => newSym.setInfo(newInfo)) } @@ -2821,7 +2821,7 @@ A type's typeSymbol should never be inspected directly. if (ps.isEmpty) throwError else if (sym eq ps.head) // @M! don't just replace the whole thing, might be followed by type application - appliedType(as.head, List.mapConserve(args)(this)) // @M: was as.head + appliedType(as.head, args mapConserve (this)) // @M: was as.head else instParam(ps.tail, as.tail); val symclazz = sym.owner if (symclazz == clazz && (pre.widen.typeSymbol isNonBottomSubClass symclazz)) { @@ -3280,7 +3280,7 @@ A type's typeSymbol should never be inspected directly. if (sym.isPackageClass) tp else { val pre1 = this(pre) - val args1 = List.mapConserve(args)(this) + val args1 = args mapConserve (this) val sym1 = adaptToNewRun(pre1, sym) if ((pre1 eq pre) && (sym1 eq sym) && (args1 eq args)/* && sym.isExternal*/) tp else typeRef(pre1, sym1, args1) @@ -3300,12 +3300,12 @@ A type's typeSymbol should never be inspected directly. case ClassInfoType(parents, decls, clazz) => if (clazz.isPackageClass) tp else { - val parents1 = List.mapConserve(parents)(this) + val parents1 = parents mapConserve (this) if (parents1 eq parents) tp else ClassInfoType(parents1, decls, clazz) } case RefinedType(parents, decls) => - val parents1 = List.mapConserve(parents)(this) + val parents1 = parents mapConserve (this) if (parents1 eq parents) tp else refinedType(parents1, tp.typeSymbol.owner, decls, tp.typeSymbol.owner.pos) case SuperType(_, _) => mapOver(tp) @@ -4310,7 +4310,7 @@ A type's typeSymbol should never be inspected directly. val ts0 = elimSub0(ts) if (ts0.length <= 1) ts0 else { - val ts1 = List.mapConserve(ts0)(t => elimAnonymousClass(t.underlying)) + val ts1 = ts0 mapConserve (t => elimAnonymousClass(t.underlying)) if (ts1 eq ts0) ts0 else elimSub(ts1, depth) } @@ -4329,7 +4329,7 @@ A type's typeSymbol should never be inspected directly. else throw new Error("trying to do lub/glb of typevar "+tp) case t => t } - val strippedTypes = List.mapConserve(ts)(stripType) + val strippedTypes = ts mapConserve (stripType) (strippedTypes, quantified) } diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index 7738692a29..e01293adab 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -45,7 +45,7 @@ abstract class Flatten extends InfoTransform { } else { val oldowner = clazz.owner atPhase(phase.next)(oldowner.info) - parents1 = List.mapConserve(parents)(this) + parents1 = parents mapConserve (this) for (sym <- decls.toList) { if (sym.isTerm && !sym.isStaticModule) { decls1 enter sym diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index b64451a3cd..19db00ae33 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -29,7 +29,7 @@ abstract class LambdaLift extends InfoTransform { typeRef(apply(sym.owner.enclClass.thisType), sym, args) } else mapOver(tp) case ClassInfoType(parents, decls, clazz) => - val parents1 = List.mapConserve(parents)(this) + val parents1 = parents mapConserve (this) if (parents1 eq parents) tp else ClassInfoType(parents1, decls, clazz) case _ => diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index b96ce58370..05aa3be60b 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -78,7 +78,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { val tp = expandAlias(tp0) tp match { case ClassInfoType(parents, decls, clazz) => - val parents1 = List.mapConserve(parents)(uncurry) + val parents1 = parents mapConserve (uncurry) if (parents1 eq parents) tp else ClassInfoType(parents1, decls, clazz) // @MAT normalize in decls?? case PolyType(_, _) => diff --git a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala index 314aee531c..5f123ffa06 100644 --- a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala +++ b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala @@ -93,7 +93,7 @@ trait EtaExpansion { self: Analyzer => defs ++= stats liftoutPrefix(fun) case Apply(fn, args) => - treeCopy.Apply(tree, liftoutPrefix(fn), List.mapConserve(args)(liftout)) setType null + treeCopy.Apply(tree, liftoutPrefix(fn), args mapConserve (liftout)) setType null case TypeApply(fn, args) => treeCopy.TypeApply(tree, liftoutPrefix(fn), args) setType null case Select(qual, name) => diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 4fc19182ef..39d34ca45b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -464,7 +464,7 @@ self: Analyzer => if (applicable.isEmpty && !invalidImplicits.isEmpty) { infer.setAddendum(tree.pos, () => - "\n Note: implicit "+invalidImplicits.first+" is not applicable here"+ + "\n Note: implicit "+invalidImplicits.head+" is not applicable here"+ "\n because it comes after the application point and it lacks an explicit result type") } diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index b2ae89700c..80c3fa1ade 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1193,7 +1193,7 @@ trait Infer { case TypeRef(_, sym, _) if sym.isAliasType => widen(tp.normalize) case rtp @ RefinedType(parents, decls) => - copyRefinedType(rtp, List.mapConserve(parents)(widen), decls) + copyRefinedType(rtp, parents mapConserve (widen), decls) case AnnotatedType(_, underlying, _) => widen(underlying) case _ => diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 8c2c076a08..8f91c823aa 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -34,7 +34,7 @@ trait Namers { self: Analyzer => case PolyType(tparams1, restpe) => new DeSkolemizeMap(tparams1 ::: tparams).mapOver(tp) case ClassInfoType(parents, decls, clazz) => - val parents1 = List.mapConserve(parents)(this) + val parents1 = parents mapConserve (this) if (parents1 eq parents) tp else ClassInfoType(parents1, decls, clazz) */ case _ => @@ -715,7 +715,7 @@ trait Namers { self: Analyzer => Namers.this.caseClassOfModuleClass get clazz.linkedModuleOfClass.moduleClass match { case Some(cdef) => def hasCopy(decls: Scope) = { - decls.elements exists (_.name == nme.copy) + decls.iterator exists (_.name == nme.copy) } if (!hasCopy(decls) && !parents.exists(p => hasCopy(p.typeSymbol.info.decls)) && diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index b609f1f24b..3402fb3aab 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1099,7 +1099,7 @@ trait Typers { self: Analyzer => */ //Console.println("parents("+clazz") = "+supertpt :: mixins);//DEBUG - List.mapConserve(supertpt :: mixins)(tpt => checkNoEscaping.privates(clazz, tpt)) + supertpt :: mixins mapConserve (tpt => checkNoEscaping.privates(clazz, tpt)) } catch { case ex: TypeError => templ.tpe = null @@ -1206,7 +1206,7 @@ trait Typers { self: Analyzer => val typedMods = removeAnnotations(cdef.mods) assert(clazz != NoSymbol) reenterTypeParams(cdef.tparams) - val tparams1 = List.mapConserve(cdef.tparams)(typedTypeDef) + val tparams1 = cdef.tparams mapConserve (typedTypeDef) val impl1 = newTyper(context.make(cdef.impl, clazz, scopeFor(cdef.impl, TypedDefScopeKind))) .typedTemplate(cdef.impl, parentTypes(cdef.impl)) val impl2 = addSyntheticMethods(impl1, clazz, context) @@ -1497,9 +1497,9 @@ trait Typers { self: Analyzer => val meth = ddef.symbol reenterTypeParams(ddef.tparams) reenterValueParams(ddef.vparamss) - val tparams1 = List.mapConserve(ddef.tparams)(typedTypeDef) + val tparams1 = ddef.tparams mapConserve (typedTypeDef) val vparamss1 = List.mapConserve(ddef.vparamss)(vparams1 => - List.mapConserve(vparams1)(typedValDef)) + vparams1 mapConserve (typedValDef)) for (vparams1 <- vparamss1; if !vparams1.isEmpty; vparam1 <- vparams1.init) { if (vparam1.symbol.tpe.typeSymbol == RepeatedParamClass) error(vparam1.pos, "*-parameter must come last") @@ -1568,7 +1568,7 @@ trait Typers { self: Analyzer => def typedTypeDef(tdef: TypeDef): TypeDef = { reenterTypeParams(tdef.tparams) // @M! - val tparams1 = List.mapConserve(tdef.tparams)(typedTypeDef) // @M! + val tparams1 = tdef.tparams mapConserve (typedTypeDef) // @M! val typedMods = removeAnnotations(tdef.mods) val rhs1 = checkNoEscaping.privates(tdef.symbol, typedType(tdef.rhs)) checkNonCyclic(tdef.symbol) @@ -1734,7 +1734,7 @@ trait Typers { self: Analyzer => vparam.symbol } - val vparams = List.mapConserve(fun.vparams)(typedValDef) + val vparams = fun.vparams mapConserve (typedValDef) // for (vparam <- vparams) { // checkNoEscaping.locals(context.scope, WildcardType, vparam.tpt); () // } @@ -1848,7 +1848,7 @@ trait Typers { self: Analyzer => if (newStats.isEmpty) stats else stats ::: newStats.toList } - val result = List.mapConserve(stats)(typedStat) + val result = stats mapConserve (typedStat) if (phase.erasedTypes) result else checkNoDoubleDefsAndAddSynthetics(result) } @@ -1857,7 +1857,7 @@ trait Typers { self: Analyzer => checkDead(constrTyperIf((mode & SCCmode) != 0).typed(arg, mode & stickyModes | newmode, pt)) def typedArgs(args: List[Tree], mode: Int) = - List.mapConserve(args)(arg => typedArg(arg, mode, 0, WildcardType)) + args mapConserve (arg => typedArg(arg, mode, 0, WildcardType)) def typedArgs(args: List[Tree], mode: Int, originalFormals: List[Type], adaptedFormals: List[Type]) = { if (isVarArgs(originalFormals)) { @@ -2755,7 +2755,7 @@ trait Typers { self: Analyzer => def typedArrayValue(elemtpt: Tree, elems: List[Tree]) = { val elemtpt1 = typedType(elemtpt, mode) - val elems1 = List.mapConserve(elems)(elem => typed(elem, mode, elemtpt1.tpe)) + val elems1 = elems mapConserve (elem => typed(elem, mode, elemtpt1.tpe)) treeCopy.ArrayValue(tree, elemtpt1, elems1) .setType( (if (isFullyDefined(pt) && !phase.erasedTypes) pt @@ -3387,7 +3387,7 @@ trait Typers { self: Analyzer => } def typedCompoundTypeTree(templ: Template) = { - val parents1 = List.mapConserve(templ.parents)(typedType(_, mode)) + val parents1 = templ.parents mapConserve (typedType(_, mode)) if (parents1 exists (_.tpe.isError)) tree setType ErrorType else { val decls = scopeFor(tree, CompoundTreeScopeKind) @@ -3488,11 +3488,11 @@ trait Typers { self: Analyzer => case Sequence(elems) => checkRegPatOK(tree.pos, mode) - val elems1 = List.mapConserve(elems)(elem => typed(elem, mode, pt)) + val elems1 = elems mapConserve (elem => typed(elem, mode, pt)) treeCopy.Sequence(tree, elems1) setType pt case Alternative(alts) => - val alts1 = List.mapConserve(alts)(alt => typed(alt, mode | ALTmode, pt)) + val alts1 = alts mapConserve (alt => typed(alt, mode | ALTmode, pt)) treeCopy.Alternative(tree, alts1) setType pt case Star(elem) => @@ -3615,7 +3615,7 @@ trait Typers { self: Analyzer => // in the then-branch above. (see pos/tcpoly_overloaded.scala) // this assert is too strict: be tolerant for errors like trait A { def foo[m[x], g]=error(""); def x[g] = foo[g/*ERR: missing argument type*/] } //assert(fun1.symbol.info.isInstanceOf[OverloadedType] || fun1.symbol.isError) //, (fun1.symbol,fun1.symbol.info,fun1.symbol.info.getClass,args,tparams)) - List.mapConserve(args)(typedHigherKindedType(_, mode)) + args mapConserve (typedHigherKindedType(_, mode)) } //@M TODO: context.undetparams = undets_fun ? @@ -3630,7 +3630,7 @@ trait Typers { self: Analyzer => case ApplyDynamic(qual, args) => val reflectiveCalls = !(settings.refinementMethodDispatch.value == "invoke-dynamic") val qual1 = typed(qual, AnyRefClass.tpe) - val args1 = List.mapConserve(args)(arg => if (reflectiveCalls) typed(arg, AnyRefClass.tpe) else typed(arg)) + val args1 = args mapConserve (arg => if (reflectiveCalls) typed(arg, AnyRefClass.tpe) else typed(arg)) treeCopy.ApplyDynamic(tree, qual1, args1) setType (if (reflectiveCalls) AnyRefClass.tpe else tree.symbol.info.resultType) case Super(qual, mix) => -- cgit v1.2.3