diff options
author | Paul Phillips <paulp@improving.org> | 2012-12-12 16:05:24 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-12-19 11:51:54 -0800 |
commit | 9e88ddf82e2d8aa779aab46aec284d5566deac14 (patch) | |
tree | 34bd76cde8ab906d36970a69ac73310d412193b8 /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | |
parent | 7c23d525ccb413d8ff3e4cc6b442e7e864608609 (diff) | |
download | scala-9e88ddf82e2d8aa779aab46aec284d5566deac14.tar.gz scala-9e88ddf82e2d8aa779aab46aec284d5566deac14.tar.bz2 scala-9e88ddf82e2d8aa779aab46aec284d5566deac14.zip |
Eliminating var-like setter tpe_= on Tree.
Deprecated tpe_= on Tree, which is redundant with and
less useful than setType. To provide a small layer of
insulation from the direct nulling out of mutable fields
used to signal the typer, added def clearType() which is
merely tree.tpe = null but is shamefaced about the null
and var-settings parts like a respectable method should be.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 4e4c1b98ac..8e274f7647 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1240,9 +1240,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { class BodyDuplicator(_context: Context) extends super.BodyDuplicator(_context) { override def castType(tree: Tree, pt: Type): Tree = { - // log(" expected type: " + pt) - // log(" tree type: " + tree.tpe) - tree.tpe = if (tree.tpe != null) fixType(tree.tpe) else null + tree modifyType fixType // log(" tree type: " + tree.tpe) val ntree = if (tree.tpe != null && !(tree.tpe <:< pt)) { val casttpe = CastMap(tree.tpe) @@ -1250,8 +1248,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { else if (casttpe <:< CastMap(pt)) gen.mkCast(tree, pt) else tree } else tree - ntree.tpe = null - ntree + + ntree.clearType() } } @@ -1679,8 +1677,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { false) // don't make private fields public val newBody = symSubstituter(body(source).duplicate) - tpt.tpe = tpt.tpe.substSym(oldtparams, newtparams) - + tpt modifyType (_.substSym(oldtparams, newtparams)) copyDefDef(tree)(vparamss = List(newSyms map ValDef), rhs = newBody) } |