Skip to content

Commit

Permalink
Fixed crash on specialized inner classes.
Browse files Browse the repository at this point in the history
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@18653 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
  • Loading branch information
dragos committed Sep 7, 2009
1 parent f6d7df0 commit 64562cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
Expand Up @@ -310,7 +310,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
case _ => false
}

(needsIt(sym.tpe)
(needsIt(sym.info)
|| (isNormalizedMember(sym) && info(sym).typeBoundsIn(env)))

}
Expand Down Expand Up @@ -733,7 +733,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {

case ClassInfoType(base, decls, clazz) =>
// val parents = base map specializedType
// log("set parents of " + clazz + " to: " + parents)
log("transformInfo " + clazz )
val res = ClassInfoType(base map specializedType, newScope(specializeClass(clazz, typeEnv(clazz))), clazz)
res

Expand Down Expand Up @@ -1211,7 +1211,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
/** Cast `tree' to 'pt', unless tpe is a subtype of pt, or pt is Unit. */
def maybeCastTo(pt: Type, tpe: Type, tree: Tree): Tree =
if ((pt == definitions.UnitClass.tpe) || (tpe <:< pt)) {
log("no need to cast from " + tpe + " to " + pt)
//log("no need to cast from " + tpe + " to " + pt)
tree
} else
gen.mkAsInstanceOf(tree, pt)
Expand Down
10 changes: 9 additions & 1 deletion src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
Expand Up @@ -94,7 +94,15 @@ abstract class Duplicators extends Analyzer {
def fixType(tpe: Type): Type = {
val tpe1 = envSubstitution(tpe)
log("tpe1: " + tpe1)
(new FixInvalidSyms)(tpe1)
val tpe2: Type = (new FixInvalidSyms)(tpe1)
val tpe3 = tpe2 match {
case TypeRef(_, sym, _) if (sym.owner == oldClassOwner) =>
log("seeing " + sym.fullNameString + " from a different angle")
tpe2.asSeenFrom(newClassOwner.thisType, oldClassOwner)
case _ => tpe2
}
log("tpe2: " + tpe3)
tpe3
}

/** Return the new symbol corresponding to `sym'. */
Expand Down

0 comments on commit 64562cd

Please sign in to comment.