diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2010-02-09 19:21:34 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2010-02-09 19:21:34 +0000 |
commit | 5087792ddace9cc76d063d6cc9327eb41c73b52d (patch) | |
tree | 03ced4061e206113a670926c4b4f53916eff4a85 /src | |
parent | d983dc8c265c5cef432c4cf0a163455dccc0c17f (diff) | |
download | scala-5087792ddace9cc76d063d6cc9327eb41c73b52d.tar.gz scala-5087792ddace9cc76d063d6cc9327eb41c73b52d.tar.bz2 scala-5087792ddace9cc76d063d6cc9327eb41c73b52d.zip |
Fixed partially specialized classes.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 77e3757092..5792b5432b 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -372,16 +372,24 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { typeEnv(cls) = env this.specializedClass((clazz, env)) = cls + // declarations of the newly specialized class 'cls' val decls1 = new Scope + // original unspecialized type parameters + var oldClassTParams: List[Symbol] = Nil + + // unspecialized type parameters of 'cls' (cloned) + var newClassTParams: List[Symbol] = Nil + val specializedInfoType: Type = { val (_, unspecParams) = splitParams(clazz.info.typeParams) - val tparams1 = cloneSymbols(unspecParams, cls) - var parents = List(subst(env, clazz.tpe).subst(unspecParams, tparams1 map (_.tpe))) + oldClassTParams = unspecParams + newClassTParams = cloneSymbols(unspecParams, cls) + var parents = List(subst(env, clazz.tpe).subst(unspecParams, newClassTParams map (_.tpe))) if (parents.head.typeSymbol.isTrait) parents = parents.head.parents.head :: parents val infoType = ClassInfoType(parents, decls1, cls) - if (tparams1.isEmpty) infoType else PolyType(tparams1, infoType) + if (newClassTParams.isEmpty) infoType else PolyType(newClassTParams, infoType) } atPhase(phase.next)(cls.setInfo(specializedInfoType)) @@ -395,7 +403,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { */ def enterMember(sym: Symbol): Symbol = { typeEnv(sym) = fullEnv ++ typeEnv(sym) // append the full environment - sym.setInfo(sym.info.substThis(clazz, ThisType(cls))) + sym.setInfo(sym.info.substThis(clazz, ThisType(cls)).subst(oldClassTParams, newClassTParams map (_.tpe))) decls1.enter(subst(fullEnv)(sym)) } |