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/javac | |
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/javac')
-rw-r--r-- | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 1eecca28c5..2a799acbc7 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -251,15 +251,15 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def basicType(): Tree = atPos(in.pos) { in.token match { - case BYTE => in.nextToken(); TypeTree(ByteClass.tpe) - case SHORT => in.nextToken(); TypeTree(ShortClass.tpe) - case CHAR => in.nextToken(); TypeTree(CharClass.tpe) - case INT => in.nextToken(); TypeTree(IntClass.tpe) - case LONG => in.nextToken(); TypeTree(LongClass.tpe) - case FLOAT => in.nextToken(); TypeTree(FloatClass.tpe) - case DOUBLE => in.nextToken(); TypeTree(DoubleClass.tpe) - case BOOLEAN => in.nextToken(); TypeTree(BooleanClass.tpe) - case _ => syntaxError("illegal start of type", skipIt = true); errorTypeTree + case BYTE => in.nextToken(); TypeTree(ByteTpe) + case SHORT => in.nextToken(); TypeTree(ShortTpe) + case CHAR => in.nextToken(); TypeTree(CharTpe) + case INT => in.nextToken(); TypeTree(IntTpe) + case LONG => in.nextToken(); TypeTree(LongTpe) + case FLOAT => in.nextToken(); TypeTree(FloatTpe) + case DOUBLE => in.nextToken(); TypeTree(DoubleTpe) + case BOOLEAN => in.nextToken(); TypeTree(BooleanTpe) + case _ => syntaxError("illegal start of type", skipIt = true); errorTypeTree } } @@ -462,7 +462,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { var rtpt = if (isVoid) { in.nextToken() - TypeTree(UnitClass.tpe) setPos in.pos + TypeTree(UnitTpe) setPos in.pos } else typ() var pos = in.currentPos val rtptName = rtpt match { @@ -785,7 +785,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { blankExpr), DefDef( Modifiers(Flags.JAVA | Flags.STATIC), nme.valueOf, List(), - List(List(makeParam("x", TypeTree(StringClass.tpe)))), + List(List(makeParam("x", TypeTree(StringTpe)))), enumType, blankExpr)) accept(RBRACE) |