diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2010-08-23 08:51:50 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2010-08-23 08:51:50 +0000 |
commit | a43eac751087b55dc7b22b0e387547a3919ac291 (patch) | |
tree | a7672c045111448dc296f6873271ebc3cbacb34d | |
parent | 3c001a598de605843255df06b0708a6d04c8ac30 (diff) | |
download | scala-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.
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 14 |
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 |