diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/AddInterfaces.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/AddInterfaces.scala | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index cab440ef52..555d0700ae 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -74,7 +74,9 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => implClassMap.getOrElse(iface, { atPhase(implClassPhase) { - log("%s.implClass == %s".format(iface, iface.implClass)) + if (iface.implClass ne NoSymbol) + log("%s.implClass == %s".format(iface, iface.implClass)) + val implName = nme.implClassName(iface.name) var impl = if (iface.owner.isClass) iface.owner.info.decl(implName) else NoSymbol @@ -86,7 +88,6 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => // error: java.lang.AssertionError: assertion failed: (scala.tools.nsc.typechecker.Contexts$NoContext$,scala.tools.nsc.typechecker.Contexts,NoContext$,trait Contexts in package typechecker) / while parsing (/scala/trunk/build/pack/lib/scala-compiler.jar(scala/tools/nsc/interactive/ContextTrees$class.class),Some(class ContextTrees$class))trait Contexts.NoContext$ linkedModule: <none>List() val originalImpl = impl - val originalImplString = originalImpl.hasFlagsToString(-1L) if (impl != NoSymbol) { // Unlink a pre-existing symbol only if the implementation class is // visible on the compilation classpath. In general this is true under @@ -112,8 +113,8 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => impl setInfo new LazyImplClassType(iface) implClassMap(iface) = impl debuglog( - "generating impl class " + impl + " " + impl.hasFlagsToString(-1L) + " in " + iface.owner + ( - if (originalImpl == NoSymbol) "" else " (cloned from " + originalImpl.fullLocationString + " " + originalImplString + ")" + "generating impl class " + impl.debugLocationString + " in " + iface.owner + ( + if (originalImpl == NoSymbol) "" else " (cloned from " + originalImpl.debugLocationString + ")" ) ) impl @@ -186,7 +187,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => case PolyType(_, restpe) => implType(restpe) } - sym setInfo implType(atPhase(currentRun.erasurePhase)(iface.info)) + sym setInfo implType(beforeErasure(iface.info)) } override def load(clazz: Symbol) { complete(clazz) } @@ -317,13 +318,11 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => override def transform(tree: Tree): Tree = { val sym = tree.symbol val tree1 = tree match { - case ClassDef(mods, name, tparams, impl) if (sym.needsImplClass) => + case ClassDef(mods, _, _, impl) if sym.needsImplClass => implClass(sym).initialize // to force lateDEFERRED flags - treeCopy.ClassDef(tree, mods | INTERFACE, name, tparams, ifaceTemplate(impl)) - case DefDef(mods, name, tparams, vparamss, tpt, rhs) - if (sym.isClassConstructor && sym.isPrimaryConstructor && sym.owner != ArrayClass) => - treeCopy.DefDef(tree, mods, name, tparams, vparamss, tpt, - addMixinConstructorCalls(rhs, sym.owner)) // (3) + copyClassDef(tree)(mods = mods | INTERFACE, impl = ifaceTemplate(impl)) + case DefDef(_,_,_,_,_,_) if sym.isClassConstructor && sym.isPrimaryConstructor && sym.owner != ArrayClass => + deriveDefDef(tree)(addMixinConstructorCalls(_, sym.owner)) // (3) case Template(parents, self, body) => val parents1 = sym.owner.info.parents map (t => TypeTree(t) setPos tree.pos) treeCopy.Template(tree, parents1, emptyValDef, body) @@ -340,7 +339,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => val mix1 = mix if (mix == tpnme.EMPTY) mix else { - val ps = atPhase(currentRun.erasurePhase) { + val ps = beforeErasure { sym.info.parents dropWhile (p => p.symbol.name != mix) } assert(!ps.isEmpty, tree); |