summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-08-18 11:02:06 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-08-20 08:11:11 +0100
commitbc4e1442b4f7942ffb64bdcc15ce93600611576b (patch)
treed1fecac3eeb4877f254003e8db66c446faf1acfc
parentd7b73d439249cdac7b4c6c0624b18da40abdd580 (diff)
downloadscala-bc4e1442b4f7942ffb64bdcc15ce93600611576b.tar.gz
scala-bc4e1442b4f7942ffb64bdcc15ce93600611576b.tar.bz2
scala-bc4e1442b4f7942ffb64bdcc15ce93600611576b.zip
Reverted closure hoisting except for functions returning a Boolean result
If our theory wrt map is correct (i.e. that it gets inlined by JVM), then closure hoisting is counter-productive because it migh well prevent the closure from being inlined. This commit removes all hoisted closures that are passed to map and leaves only those boolean closures that are passed to exists and forall. I should have split the early optimizations including closures into separate commits. As that train has left, I am now reverting some bits to see whether the reverts affect performance at all, and in what direction.
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala26
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala8
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala38
-rw-r--r--src/reflect/scala/reflect/internal/pickling/UnPickler.scala4
13 files changed, 45 insertions, 57 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index e02e10b5ad..570704f049 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -451,7 +451,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
BLOCK(
VAL(sym) === qual0,
- callAsReflective(mparams map tpeOfSymbol, resType)
+ callAsReflective(mparams map (_.tpe), resType)
)
}
}
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 7247770f4b..77ad65957d 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -385,7 +385,7 @@ abstract class ExplicitOuter extends InfoTransform
def makeGuardDef(vs: List[Symbol], guard: Tree) = {
val gdname = unit.freshTermName("gd")
val method = currentOwner.newMethod(gdname, tree.pos, SYNTHETIC)
- val params = method newSyntheticValueParams vs.map(tpeOfSymbol)
+ val params = method newSyntheticValueParams vs.map(_.tpe)
method setInfo new MethodType(params, BooleanClass.tpe)
localTyper typed {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 1870e1511e..aa1bc0ce9d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -664,7 +664,7 @@ trait Infer {
val appmeth = {
//OPT cut down on #closures by special casing non-overloaded case
// was: tp.nonPrivateMember(nme.apply) filter (_.isPublic)
- val result = tp.nonPrivateMember(nme.apply)
+ val result = tp.nonPrivateMember(nme.apply)
if ((result eq NoSymbol) || !result.isOverloaded && result.isPublic) result
else result filter (_.isPublic)
}
@@ -1646,7 +1646,7 @@ trait Infer {
else eligible filter { alt =>
// for functional values, the `apply` method might be overloaded
val mtypes = followApply(alt.tpe) match {
- case OverloadedType(_, alts) => alts map tpeOfSymbol
+ case OverloadedType(_, alts) => alts map (_.tpe)
case t => t :: Nil
}
// Drop those that use a default; keep those that use vararg/tupling conversion.
@@ -1783,7 +1783,7 @@ trait Infer {
else if (sym.isOverloaded) {
val xs = sym.alternatives
val tparams = new AsSeenFromMap(pre, xs.head.owner) mapOver xs.head.typeParams
- val bounds = tparams map tpeHKOfSymbol // see e.g., #1236
+ val bounds = tparams map (_.tpeHK) // see e.g., #1236
val tpe = PolyType(tparams, OverloadedType(AntiPolyType(pre, bounds), xs))
(sym setInfo tpe, tpe)
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index cdbdb82e9f..4f597f97c9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -41,7 +41,7 @@ trait MethodSynthesis {
require(container.owner.isPackageClass, "Container must be a top-level class in a package: " + container)
require(tparams.size == args.size, "Arguments must match type constructor arity: " + tparams + ", " + args)
- appliedType(container, args map tpeOfSymbol: _*)
+ appliedType(container, args map (_.tpe): _*)
}
def companionType[T](implicit ct: CT[T]) =
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
index eaa18c142c..c60118a8b4 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
@@ -3299,7 +3299,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
// TODO: I don't think the binder's types can actually be different (due to checks in caseEquals)
// if they do somehow manage to diverge, the lub might not be precise enough and we could get a type error
// TODO: reuse name exactly if there's only one binder in binders
- val binder = freshSym(binders.head.pos, lub(binders.map(tpeOfSymbol)), binders.head.name.toString)
+ val binder = freshSym(binders.head.pos, lub(binders.map(_.tpe)), binders.head.name.toString)
// the patterns in same are equal (according to caseEquals)
// we can thus safely pick the first one arbitrarily, provided we correct binding
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index f87ca4997d..9201981635 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1677,7 +1677,7 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R
tree
case TypeApply(fn, args) =>
- checkBounds(tree, NoPrefix, NoSymbol, fn.tpe.typeParams, args map tpeOfTree)
+ checkBounds(tree, NoPrefix, NoSymbol, fn.tpe.typeParams, args map (_.tpe))
transformCaseApply(tree, ())
case x @ Apply(_, _) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 80777aa701..63050bc032 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -418,7 +418,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
val code = DefDef(newAcc, {
val (receiver :: _) :: tail = newAcc.paramss
val base: Tree = Select(Ident(receiver), sym)
- val allParamTypes = mapParamss(sym)(tpeOfSymbol)
+ val allParamTypes = mapParamss(sym)(_.tpe)
val args = map2(tail, allParamTypes)((params, tpes) => map2(params, tpes)(makeArg(_, receiver, _)))
args.foldLeft(base)(Apply(_, _))
})
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 2e680c8df6..dfe08c398e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1315,7 +1315,7 @@ trait Typers extends Modes with Adaptations with Tags {
def adaptToArguments(qual: Tree, name: Name, args: List[Tree], pt: Type, reportAmbiguous: Boolean, saveErrors: Boolean): Tree = {
def doAdapt(restpe: Type) =
//util.trace("adaptToArgs "+qual+", name = "+name+", argtpes = "+(args map (_.tpe))+", pt = "+pt+" = ")
- adaptToMember(qual, HasMethodMatching(name, args map tpeOfTree, restpe), reportAmbiguous, saveErrors)
+ adaptToMember(qual, HasMethodMatching(name, args map (_.tpe), restpe), reportAmbiguous, saveErrors)
if (pt != WildcardType) {
silent(_ => doAdapt(pt)) match {
case SilentResultValue(result) if result != qual =>
@@ -1443,7 +1443,7 @@ trait Typers extends Modes with Adaptations with Tags {
val supertparams = if (supertpt.hasSymbol) supertpt.symbol.typeParams else List()
var supertpe = supertpt.tpe
if (!supertparams.isEmpty)
- supertpe = PolyType(supertparams, appliedType(supertpe, supertparams map tpeHKOfSymbol))
+ supertpe = PolyType(supertparams, appliedType(supertpe, supertparams map (_.tpeHK)))
// A method to replace a super reference by a New in a supercall
def transformSuperCall(scall: Tree): Tree = (scall: @unchecked) match {
@@ -1877,7 +1877,7 @@ trait Typers extends Modes with Adaptations with Tags {
val params = fn.tpe.params
val args2 = if (params.isEmpty || !isRepeatedParamType(params.last.tpe)) args
else args.take(params.length - 1) :+ EmptyTree
- assert(sameLength(args2, params) || call.isErrorTyped, "mismatch " + clazz + " " + (params map tpeOfSymbol) + " " + args2)//debug
+ assert(sameLength(args2, params) || call.isErrorTyped, "mismatch " + clazz + " " + (params map (_.tpe)) + " " + args2)//debug
(superConstr, args1 ::: args2)
case Block(stats, expr) if !stats.isEmpty =>
decompose(stats.last)
@@ -2011,7 +2011,7 @@ trait Typers extends Modes with Adaptations with Tags {
case SilentResultValue(tpt) =>
val alias = enclClass.newAliasType(name.toTypeName, useCase.pos)
val tparams = cloneSymbolsAtOwner(tpt.tpe.typeSymbol.typeParams, alias)
- val newInfo = genPolyType(tparams, appliedType(tpt.tpe, tparams map tpeOfSymbol))
+ val newInfo = genPolyType(tparams, appliedType(tpt.tpe, tparams map (_.tpe)))
alias setInfo newInfo
context.scope.enter(alias)
case _ =>
@@ -2340,7 +2340,7 @@ trait Typers extends Modes with Adaptations with Tags {
val (resTp, needAdapt) =
if (opt.virtPatmat) ptOrLubPacked(casesTyped, pt)
- else ptOrLub(casesTyped map tpeOfTree, pt)
+ else ptOrLub(casesTyped map (_.tpe), pt)
val casesAdapted = if (!needAdapt) casesTyped else casesTyped map (adaptCase(_, mode, resTp))
@@ -2428,7 +2428,7 @@ trait Typers extends Modes with Adaptations with Tags {
val match_ = methodBodyTyper.typedMatch(gen.mkUnchecked(selector), cases, mode, ptRes)
val resTp = match_.tpe
- val methFormals = paramSyms map tpeOfSymbol
+ val methFormals = paramSyms map (_.tpe)
val parents = (
if (isPartial) parentsPartial(List(methFormals.head, resTp))
else addSerializable(abstractFunctionType(methFormals, resTp))
@@ -2594,7 +2594,7 @@ trait Typers extends Modes with Adaptations with Tags {
// for (vparam <- vparams) {
// checkNoEscaping.locals(context.scope, WildcardType, vparam.tpt); ()
// }
- val formals = vparamSyms map tpeOfSymbol
+ val formals = vparamSyms map (_.tpe)
val body1 = typed(fun.body, respt)
val restpe = packedType(body1, fun.symbol).deconst.resultType
val funtpe = typeRef(clazz.tpe.prefix, clazz, formals :+ restpe)
@@ -3565,7 +3565,7 @@ trait Typers extends Modes with Adaptations with Tags {
// Higher-kinded existentials are not yet supported, but this is
// tpeHK for when they are: "if a type constructor is expected/allowed,
// tpeHK must be called instead of tpe."
- val typeParamTypes = typeParams map tpeHKOfSymbol
+ val typeParamTypes = typeParams map (_.tpeHK)
def doSubst(info: Type) = info.subst(rawSyms, typeParamTypes)
creator(typeParams map (_ modifyInfo doSubst), doSubst(tp))
@@ -3701,7 +3701,7 @@ trait Typers extends Modes with Adaptations with Tags {
// lifted out of typed1 because it's needed in typedImplicit0
protected def typedTypeApply(tree: Tree, mode: Int, fun: Tree, args: List[Tree]): Tree = fun.tpe match {
case OverloadedType(pre, alts) =>
- inferPolyAlternatives(fun, args map tpeOfTree)
+ inferPolyAlternatives(fun, args map (_.tpe))
val tparams = fun.symbol.typeParams //@M TODO: fun.symbol.info.typeParams ? (as in typedAppliedTypeTree)
val args1 = if (sameLength(args, tparams)) {
//@M: in case TypeApply we can't check the kind-arities of the type arguments,
@@ -3721,7 +3721,7 @@ trait Typers extends Modes with Adaptations with Tags {
typedTypeApply(tree, mode, fun setType fun.tpe.widen, args)
case PolyType(tparams, restpe) if tparams.nonEmpty =>
if (sameLength(tparams, args)) {
- val targs = args map tpeOfTree
+ val targs = args map (_.tpe)
checkBounds(tree, NoPrefix, NoSymbol, tparams, targs, "")
if (fun.symbol == Predef_classOf)
typedClassOf(tree, args.head, true)
@@ -4139,7 +4139,7 @@ trait Typers extends Modes with Adaptations with Tags {
context.undetparams = cloneSymbols(tpt0.symbol.typeParams)
notifyUndetparamsAdded(context.undetparams)
TypeTree().setOriginal(tpt0)
- .setType(appliedType(tpt0.tpe, context.undetparams map tpeHKOfSymbol)) // @PP: tpeHK! #3343, #4018, #4347.
+ .setType(appliedType(tpt0.tpe, context.undetparams map (_.tpeHK))) // @PP: tpeHK! #3343, #4018, #4347.
} else tpt0
else tpt0
}
@@ -4921,7 +4921,7 @@ trait Typers extends Modes with Adaptations with Tags {
else {
val decls = newScope
//Console.println("Owner: " + context.enclClass.owner + " " + context.enclClass.owner.id)
- val self = refinedType(parents1 map tpeOfTree, context.enclClass.owner, decls, templ.pos)
+ val self = refinedType(parents1 map (_.tpe), context.enclClass.owner, decls, templ.pos)
newTyper(context.make(templ, self.typeSymbol, decls)).typedRefinement(templ)
templ addAttachment CompoundTypeTreeOriginalAttachment(parents1, Nil) // stats are set elsewhere
tree setType self
@@ -4948,7 +4948,7 @@ trait Typers extends Modes with Adaptations with Tags {
//@M! the polytype denotes the expected kind
typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyClass.tpe))
}
- val argtypes = args1 map tpeOfTree
+ val argtypes = args1 map (_.tpe)
foreach2(args, tparams)((arg, tparam) => arg match {
// note: can't use args1 in selector, because Bind's got replaced
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index 14547123b0..98d42b724c 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -759,7 +759,7 @@ trait Definitions extends api.StandardDefinitions {
// java.lang.Object. Java also special cases the return type.
lazy val Any_getClass = enterNewMethod(AnyClass, nme.getClass_, Nil, getMemberMethod(ObjectClass, nme.getClass_).tpe.resultType, DEFERRED)
lazy val Any_isInstanceOf = newT1NullaryMethod(AnyClass, nme.isInstanceOf_, FINAL)(_ => booltype)
- lazy val Any_asInstanceOf = newT1NullaryMethod(AnyClass, nme.asInstanceOf_, FINAL)(typeConstructorOfSymbol)
+ lazy val Any_asInstanceOf = newT1NullaryMethod(AnyClass, nme.asInstanceOf_, FINAL)(_.typeConstructor)
// A type function from T => Class[U], used to determine the return
// type of getClass calls. The returned type is:
@@ -851,7 +851,7 @@ trait Definitions extends api.StandardDefinitions {
lazy val Object_eq = enterNewMethod(ObjectClass, nme.eq, anyrefparam, booltype, FINAL)
lazy val Object_ne = enterNewMethod(ObjectClass, nme.ne, anyrefparam, booltype, FINAL)
lazy val Object_isInstanceOf = newT1NoParamsMethod(ObjectClass, nme.isInstanceOf_Ob, FINAL | SYNTHETIC)(_ => booltype)
- lazy val Object_asInstanceOf = newT1NoParamsMethod(ObjectClass, nme.asInstanceOf_Ob, FINAL | SYNTHETIC)(typeConstructorOfSymbol)
+ lazy val Object_asInstanceOf = newT1NoParamsMethod(ObjectClass, nme.asInstanceOf_Ob, FINAL | SYNTHETIC)(_.typeConstructor)
lazy val Object_synchronized = newPolyMethod(1, ObjectClass, nme.synchronized_, FINAL)(tps =>
(Some(List(tps.head.typeConstructor)), tps.head.typeConstructor)
)
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 5ae045b404..09ac3e5f6f 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -1906,7 +1906,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
if ((result eq NoSymbol) || !result.isOverloaded && qualifies(result)) result
else result filter qualifies
}
-
+
/** The non-private member of `site` whose type and name match the type of this symbol. */
final def matchingSymbol(site: Type, admit: Long = 0L): Symbol =
site.nonPrivateMemberAdmitting(name, admit).filter(sym =>
@@ -2631,7 +2631,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
tpeCache = NoType
val targs =
if (phase.erasedTypes && this != ArrayClass) List()
- else unsafeTypeParams map typeConstructorOfSymbol
+ else unsafeTypeParams map (_.typeConstructor)
//@M! use typeConstructor to generate dummy type arguments,
// sym.tpe should not be called on a symbol that's supposed to be a higher-kinded type
// memberType should be used instead, that's why it uses tpeHK and not tpe
@@ -3217,10 +3217,6 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
private[scala] final val symbolIsPossibleInRefinement = (sym: Symbol) => sym.isPossibleInRefinement
private[scala] final val symbolIsNonVariant = (sym: Symbol) => sym.variance == 0
- private[scala] final val typeConstructorOfSymbol = (sym: Symbol) => sym.typeConstructor
- private[scala] final val tpeOfSymbol = (sym: Symbol) => sym.tpe
- private[scala] final val infoOfSymbol = (sym: Symbol) => sym.info
- private[scala] final val tpeHKOfSymbol = (sym: Symbol) => sym.tpeHK
@tailrec private[scala] final
def allSymbolsHaveOwner(syms: List[Symbol], owner: Symbol): Boolean = syms match {
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index b4bfbd410a..0180ed4c4f 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -1543,10 +1543,6 @@ trait Trees extends api.Trees { self: SymbolTable =>
sys.error("Not a LabelDef: " + t + "/" + t.getClass)
}
-// ----- Hoisted closures and convenience methods, for compile time reductions -------
-
- private[scala] final val tpeOfTree = (tree: Tree) => tree.tpe
-
// -------------- Classtags --------------------------------------------------------
implicit val TreeTag = ClassTag[Tree](classOf[Tree])
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 6d718eed79..01f615c5cc 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -517,7 +517,7 @@ trait Types extends api.Types { self: SymbolTable =>
/** A list of placeholder types derived from the type parameters.
* Used by RefinedType and TypeRef.
*/
- protected def dummyArgs: List[Type] = typeParams map typeConstructorOfSymbol
+ protected def dummyArgs: List[Type] = typeParams map (_.typeConstructor)
/** For a (nullary) method or poly type, its direct result type,
* the type itself for all other types. */
@@ -869,7 +869,7 @@ trait Types extends api.Types { self: SymbolTable =>
case (TypeRef(_, ArrayClass, List(arg1)), TypeRef(_, ArrayClass, List(arg2))) if arg2.typeSymbol.typeParams.nonEmpty =>
arg1 matchesPattern arg2
case (_, TypeRef(_, _, args)) =>
- val newtp = existentialAbstraction(args map typeSymbolOfType, that)
+ val newtp = existentialAbstraction(args map (_.typeSymbol), that)
!(that =:= newtp) && (this <:< newtp)
case _ =>
false
@@ -1759,7 +1759,7 @@ trait Types extends api.Types { self: SymbolTable =>
//@M may result in an invalid type (references to higher-order args become dangling )
override def typeConstructor =
- copyRefinedType(this, parents map typeConstructorOfType, decls)
+ copyRefinedType(this, parents map (_.typeConstructor), decls)
final override def normalize: Type =
if (phase.erasedTypes) normalizeImpl
@@ -2349,7 +2349,7 @@ trait Types extends api.Types { self: SymbolTable =>
private[reflect] var baseTypeSeqCache: BaseTypeSeq = _
private[reflect] var baseTypeSeqPeriod = NoPeriod
private var normalized: Type = _
-
+
//OPT specialize hashCode
override final def computeHashCode = {
import scala.util.hashing.MurmurHash3._
@@ -2357,9 +2357,9 @@ trait Types extends api.Types { self: SymbolTable =>
var h = productSeed
h = mix(h, pre.hashCode)
h = mix(h, sym.hashCode)
- if (hasArgs)
+ if (hasArgs)
finalizeHash(mix(h, args.hashCode), 3)
- else
+ else
finalizeHash(h, 2)
}
@@ -2608,7 +2608,7 @@ trait Types extends api.Types { self: SymbolTable =>
override def paramss: List[List[Symbol]] = params :: resultType.paramss
- override def paramTypes = params map tpeOfSymbol
+ override def paramTypes = params map (_.tpe)
override def boundSyms = resultType.boundSyms ++ params
@@ -2994,7 +2994,7 @@ trait Types extends api.Types { self: SymbolTable =>
tpe exists typeIsExistentiallyBound
def existentialsInType(tpe: Type) =
- tpe withFilter typeIsExistentiallyBound map typeSymbolOfType
+ tpe withFilter typeIsExistentiallyBound map (_.typeSymbol)
/** Precondition: params.nonEmpty. (args.nonEmpty enforced structurally.)
*/
@@ -3311,7 +3311,7 @@ trait Types extends api.Types { self: SymbolTable =>
if (constr.instValid) constr.inst
// get here when checking higher-order subtyping of the typevar by itself
// TODO: check whether this ever happens?
- else if (isHigherKinded) typeFun(params, applyArgs(params map typeConstructorOfSymbol))
+ else if (isHigherKinded) typeFun(params, applyArgs(params map (_.typeConstructor)))
else super.normalize
)
override def typeSymbol = origin.typeSymbol
@@ -3696,7 +3696,7 @@ trait Types extends api.Types { self: SymbolTable =>
val bounds = args map (TypeBounds upper _)
foreach2(eparams, bounds)(_ setInfo _)
- newExistentialType(eparams, typeRef(pre, sym, eparams map tpeOfSymbol))
+ newExistentialType(eparams, typeRef(pre, sym, eparams map (_.tpe)))
case _ =>
appliedType(tycon, args)
}
@@ -4355,7 +4355,7 @@ trait Types extends api.Types { self: SymbolTable =>
else try {
expanded += sym
val eparams = mapOver(typeParamsToExistentials(sym))
- existentialAbstraction(eparams, typeRef(apply(pre), sym, eparams map tpeOfSymbol))
+ existentialAbstraction(eparams, typeRef(apply(pre), sym, eparams map (_.tpe)))
} finally {
expanded -= sym
}
@@ -5174,9 +5174,9 @@ trait Types extends api.Types { self: SymbolTable =>
case NullaryMethodType(result) =>
typeDepth(result)
case PolyType(tparams, result) =>
- typeDepth(result) max typeDepth(tparams map infoOfSymbol) + 1
+ typeDepth(result) max typeDepth(tparams map (_.info)) + 1
case ExistentialType(tparams, result) =>
- typeDepth(result) max typeDepth(tparams map infoOfSymbol) + 1
+ typeDepth(result) max typeDepth(tparams map (_.info)) + 1
case _ =>
1
}
@@ -5193,7 +5193,7 @@ trait Types extends api.Types { self: SymbolTable =>
}
loop(tps, 0)
}
-
+
private def typeDepth(tps: List[Type]): Int = maxDepth(tps, typeDepth)
private def baseTypeSeqDepth(tps: List[Type]): Int = maxDepth(tps, _.baseTypeSeqDepth)
@@ -6346,8 +6346,8 @@ trait Types extends api.Types { self: SymbolTable =>
*/
private def lubList(ts: List[Type], depth: Int): List[Type] = {
// Matching the type params of one of the initial types means dummies.
- val initialTypeParams = ts map typeParamsOfType
- def isHotForTs(xs: List[Type]) = initialTypeParams contains (xs map typeSymbolOfType)
+ val initialTypeParams = ts map (_.typeParams)
+ def isHotForTs(xs: List[Type]) = initialTypeParams contains (xs map (_.typeSymbol))
def elimHigherOrderTypeParam(tp: Type) = tp match {
case TypeRef(pre, sym, args) if args.nonEmpty && isHotForTs(args) => tp.typeConstructor
@@ -7128,10 +7128,6 @@ trait Types extends api.Types { self: SymbolTable =>
private[scala] val typeIsAny = (tp: Type) => tp.typeSymbolDirect eq AnyClass
private[scala] val typeIsHigherKinded = (tp: Type) => tp.isHigherKinded
- private[scala] val typeSymbolOfType = (tp: Type) => tp.typeSymbol
- private[scala] val typeParamsOfType = (tp: Type) => tp.typeParams
- private[scala] val typeConstructorOfType = (tp: Type) => tp.typeConstructor
-
@tailrec private def typesContain(tps: List[Type], sym: Symbol): Boolean = tps match {
case tp :: rest => (tp contains sym) || typesContain(rest, sym)
case _ => false
@@ -7197,7 +7193,7 @@ object TypesStats {
@inline final def timedTypeOp[T](c: Statistics.StackableTimer)(op: => T): T = {
val start = Statistics.pushTimer(typeOpsStack, c)
try op
- finally
+ finally
}
*/
}
diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
index 38f61d3e93..2e00316d5b 100644
--- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
+++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
@@ -677,7 +677,7 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ {
val args = until(end, readTreeRef)
if (fun.symbol.isOverloaded) {
fun.setType(fun.symbol.info)
- inferMethodAlternative(fun, args map tpeOfTree, tpe)
+ inferMethodAlternative(fun, args map (_.tpe), tpe)
}
Apply(fun, args)
@@ -782,7 +782,7 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ {
}
r.asInstanceOf[Symbol]
}
-
+
protected def readNameRef(): Name = at(readNat(), readName)
protected def readTypeRef(): Type = at(readNat(), () => readType()) // after the NMT_TRANSITION period, we can leave off the () => ... ()
protected def readConstantRef(): Constant = at(readNat(), readConstant)