summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2010-08-23 08:51:50 +0000
committerIulian Dragos <jaguarul@gmail.com>2010-08-23 08:51:50 +0000
commita43eac751087b55dc7b22b0e387547a3919ac291 (patch)
treea7672c045111448dc296f6873271ebc3cbacb34d /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
parent3c001a598de605843255df06b0708a6d04c8ac30 (diff)
downloadscala-a43eac751087b55dc7b22b0e387547a3919ac291.tar.gz
scala-a43eac751087b55dc7b22b0e387547a3919ac291.tar.bz2
scala-a43eac751087b55dc7b22b0e387547a3919ac291.zip
Don't box class parameters when passed to the s...
Don't box class parameters when passed to the super constructor, from specialized subclasses.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 1350ab3bb4..0b461c0911 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -950,8 +950,6 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
satisfiable(env, silent)
}
- /*************************** Term transformation ************************************/
-
class Duplicator extends {
val global: SpecializeTypes.this.global.type = SpecializeTypes.this.global
} with typechecker.Duplicators
@@ -1144,7 +1142,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
if (symbol.isConstructor) {
val t = atOwner(symbol) {
val superRef: Tree = Select(Super(nme.EMPTY.toTypeName, nme.EMPTY.toTypeName), nme.CONSTRUCTOR)
- forwardCall(tree.pos, superRef, vparamss)
+ forwardCtorCall(tree.pos, superRef, vparamss)
}
if (symbol.isPrimaryConstructor) localTyper typed {
atPos(symbol.pos)(treeCopy.DefDef(tree, mods, name, tparams, vparamss, tpt, Block(List(t), Literal(()))))
@@ -1395,6 +1393,16 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
atPos(pos) { (receiver /: argss) (Apply) }
}
+ private def forwardCtorCall(pos: util.Position, receiver: Tree, paramss: List[List[ValDef]]): Tree = {
+ val argss = paramss map (_ map (x =>
+ if (x.name.endsWith("$sp"))
+ gen.mkAsInstanceOf(Literal(Constant(null)), x.symbol.tpe)
+ else
+ Ident(x.symbol))
+ )
+ atPos(pos) { (receiver /: argss) (Apply) }
+ }
+
/** Concrete methods that use a specialized type, or override such methods. */
private val concreteSpecMethods: mutable.Set[Symbol] = new mutable.HashSet