fix^3: bug744

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@8715 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
odersky 2006-09-20 14:27:12 +00:00
parent 4135328aee
commit e68f0bb1e9
3 changed files with 28 additions and 8 deletions

View File

@ -251,15 +251,12 @@ abstract class AddInterfaces extends InfoTransform {
def mixinConstructorCall(mixinClass: Symbol): Tree = atPos(tree.pos) {
Apply(Select(This(clazz), mixinClass.primaryConstructor), List())
}
def toImplClass(mc: Symbol) =
if (mc.isImplClass) mc else implClass(mc)
def hasMixinConstructor(mc: Symbol) = {
mc.info;
(mc.isImplClass || mc.needsImplClass) && mc.toInterface != ScalaObjectClass
}
def toImplClass(sym: Symbol) =
if (sym.needsImplClass) implClass(sym) else sym
val mixinConstructorCalls: List[Tree] = {
for (val mc <- clazz.mixinClasses.reverse; hasMixinConstructor(mc))
yield mixinConstructorCall(toImplClass(mc))
for (val mc <- clazz.mixinClasses.reverse.map(toImplClass).removeDuplicates;
mc.isImplClass && mc.toInterface != ScalaObjectClass)
yield mixinConstructorCall(mc)
}
tree match { //todo: remove checking code
case Block(supercall :: stats, expr) =>

View File

@ -0,0 +1,3 @@
BEGIN
Hello from linked
END

View File

@ -0,0 +1,20 @@
trait Linked {
type File <: FileImpl;
trait FileImpl {
Console.println("Hello from linked");
}
}
object Test {
class Test extends Linked {
trait FileImpl extends super.FileImpl {
// val x: int = 1
}
class File extends FileImpl;
}
def main(args : Array[String]) : Unit = {
Console.println("BEGIN");
val test = new Test;
val file = new test.File;
Console.println("END");
}
}