diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-14 04:27:35 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-14 04:27:35 +0000 |
commit | 9ea2cefb2079aebad2b215f6a699fe6262e2c7a7 (patch) | |
tree | e4d894071f77fce25db53aef313afc4b111c2362 /src | |
parent | fcd0998f1e0f2307e9b0cbae6bf2c36234ca8d17 (diff) | |
download | scala-9ea2cefb2079aebad2b215f6a699fe6262e2c7a7.tar.gz scala-9ea2cefb2079aebad2b215f6a699fe6262e2c7a7.tar.bz2 scala-9ea2cefb2079aebad2b215f6a699fe6262e2c7a7.zip |
Another swing at r25823.
I verified this creates identical library bytecode so I anticipate no
regressions. Review by prokopec anyway.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 0f07ac0641..80971b9917 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -503,7 +503,18 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val extraSpecializedMixins = specializedParents(clazz.info.parents.map(applyContext)) if (extraSpecializedMixins.nonEmpty) debuglog("specializeClass on " + clazz + " founds extra specialized mixins: " + extraSpecializedMixins.mkString(", ")) - + // If the class being specialized has a self-type, the self type may + // require specialization. First exclude classes whose self types have + // the same type constructor as the class itself, since they will + // already be covered. Then apply the current context to the self-type + // as with the parents and assign it to typeOfThis. + if (clazz.typeOfThis.typeConstructor ne clazz.typeConstructor) { + cls.typeOfThis = applyContext(clazz.typeOfThis) + log("Rewriting self-type for specialized class:\n" + + " " + clazz.defStringSeenAs(clazz.typeOfThis) + "\n" + + " => " + cls.defStringSeenAs(cls.typeOfThis) + ) + } val infoType = ClassInfoType(parents ::: extraSpecializedMixins, decls1, cls) if (newClassTParams.isEmpty) infoType else PolyType(newClassTParams, infoType) } |