diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-23 10:00:50 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-23 12:07:45 -0700 |
commit | d8b96bb8583161e59180527bab0283f783466426 (patch) | |
tree | a12ecf17379a579d5a2f4bda7a16819001eadb77 /src/compiler/scala/tools/nsc/transform/UnCurry.scala | |
parent | b8641a97d669c945a1b9f47b4e8934aa6c98ffd7 (diff) | |
download | scala-d8b96bb8583161e59180527bab0283f783466426.tar.gz scala-d8b96bb8583161e59180527bab0283f783466426.tar.bz2 scala-d8b96bb8583161e59180527bab0283f783466426.zip |
Concision contribution.
We have lots of core classes for which we need not go through
the symbol to get the type:
ObjectClass.tpe -> ObjectTpe
AnyClass.tpe -> AnyTpe
I updated everything to use the concise/direct version,
and eliminated a bunch of noise where places were calling
typeConstructor, erasedTypeRef, and other different-seeming methods
only to always wind up with the same type they would have received
from sym.tpe. There's only one Object type, before or after erasure,
with or without type arguments.
Calls to typeConstructor were especially damaging because (see
previous commit) it had a tendency to cache a different type than
the type one would find via other means. The two types would
compare =:=, but possibly not == and definitely not eq. (I still
don't understand what == is expected to do with types.)
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/UnCurry.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index d7be0ed180..64f4e579e1 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -142,7 +142,7 @@ abstract class UnCurry extends InfoTransform /** Return non-local return key for given method */ private def nonLocalReturnKey(meth: Symbol) = nonLocalReturnKeys.getOrElseUpdate(meth, - meth.newValue(unit.freshTermName("nonLocalReturnKey"), meth.pos, SYNTHETIC) setInfo ObjectClass.tpe + meth.newValue(unit.freshTermName("nonLocalReturnKey"), meth.pos, SYNTHETIC) setInfo ObjectTpe ) /** Generate a non-local return throw with given return expression from given method. @@ -184,7 +184,7 @@ abstract class UnCurry extends InfoTransform THEN ((ex DOT nme.value)()) ELSE (Throw(Ident(ex))) ) - val keyDef = ValDef(key, New(ObjectClass.tpe)) + val keyDef = ValDef(key, New(ObjectTpe)) val tryCatch = Try(body, pat -> rhs) for (Try(t, catches, _) <- body ; cdef <- catches ; if treeInfo catchesThrowable cdef) @@ -291,7 +291,7 @@ abstract class UnCurry extends InfoTransform def getClassTag(tp: Type): Tree = { val tag = localTyper.resolveClassTag(tree.pos, tp) // Don't want bottom types getting any further than this (SI-4024) - if (tp.typeSymbol.isBottomClass) getClassTag(AnyClass.tpe) + if (tp.typeSymbol.isBottomClass) getClassTag(AnyTpe) else if (!tag.isEmpty) tag else if (tp.bounds.hi ne tp) getClassTag(tp.bounds.hi) else localTyper.TyperErrorGen.MissingClassTagError(tree, tp) @@ -547,7 +547,7 @@ abstract class UnCurry extends InfoTransform def isThrowable(pat: Tree): Boolean = pat match { case Typed(Ident(nme.WILDCARD), tpt) => - tpt.tpe =:= ThrowableClass.tpe + tpt.tpe =:= ThrowableTpe case Bind(_, pat) => isThrowable(pat) case _ => @@ -735,7 +735,7 @@ abstract class UnCurry extends InfoTransform // becomes def foo[T](a: Int, b: Array[Object]) // instead of def foo[T](a: Int, b: Array[T]) ===> def foo[T](a: Int, b: Object) arrayType( - if (arg.typeSymbol.isTypeParameterOrSkolem) ObjectClass.tpe + if (arg.typeSymbol.isTypeParameterOrSkolem) ObjectTpe else arg ) } |