Aladdin - Scala Bugtracking
[#816] project: compiler priority: high category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-11-11 13:53:08.0
subject Mixin override very broken in latest.
code
// MUST be in two files.
// file HasDirXXX.scala
package lampion.scalax;
object HasDirXXX {
  abstract class Dir;
  object PREV extends Dir;
  object NEXT extends Dir;
}
// file BraceMatcherXXX.scala
package lampion.scalax;
trait BraceMatcherXXX { 
  type Dir = HasDirXXX.Dir;
  trait NodeImpl { 
    def scanWithSkip(dir : Dir) : NodeImpl = null; 
  }
  trait Matchable extends NodeImpl {
    override def scanWithSkip(dir : Dir) : NodeImpl = super.scanWithSkip(dir);
  }
  class MatchableX extends Matchable with NodeImpl;
}
what happened
sean-mcdirmid:~/workspace/lampion/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin -sourcepath . \
lampion/scalax/NewScalaTestXXX.scala
exception when traversing BraceMatcherXXX$MatchableX.super.scanWithSkip(x$1.$asInstanceOf[lampion.scalax.HasDirX\
XX$Dir]())
exception when traversing java.lang.Object with lampion.scalax.BraceMatcherXXX$Matchable with lampion.scalax.Bra\
ceMatcherXXX$NodeImpl with scala.ScalaObject {
  protected   val $outer: lampion.scalax.BraceMatcherXXX = _;
    def lampion$scalax$BraceMatcherXXX$MatchableX$$$outer(): lampion.scalax.BraceMatcherXXX =\
 BraceMatcherXXX$MatchableX.this.$outer;
    def lampion$scalax$BraceMatcherXXX$Matchable$$$outer(): lampion.scalax.BraceMatcherXXX = \
BraceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
    def lampion$scalax$BraceMatcherXXX$NodeImpl$$$outer(): lampion.scalax.BraceMatcherXXX = B\
raceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
  def this($outer: lampion.scalax.BraceMatcherXXX): lampion.scalax.BraceMatcherXXX$MatchableX = {
    if ($outer.eq(null))
      throw new java.lang.NullPointerException()
    else
      BraceMatcherXXX$MatchableX.this.$outer = $outer;
    BraceMatcherXXX$MatchableX.super.this();
    BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$NodeImpl]()./*BraceMatcherXXX$N\
odeImpl$class*/$init$();
    BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$Matchable]()./*BraceMatcherXXX$\
Matchable$class*/$init$();
    ()
  }
}
exception when traversing class BraceMatcherXXX$MatchableX extends java.lang.Object with lampion.scalax.BraceMat\
cherXXX$Matchable with lampion.scalax.BraceMatcherXXX$NodeImpl with scala.ScalaObject {
  protected   val $outer: lampion.scalax.BraceMatcherXXX = _;
    def lampion$scalax$BraceMatcherXXX$MatchableX$$$outer(): lampion.scalax.BraceMatcherXXX =\
 BraceMatcherXXX$MatchableX.this.$outer;
    def lampion$scalax$BraceMatcherXXX$Matchable$$$outer(): lampion.scalax.BraceMatcherXXX = \
BraceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
    def lampion$scalax$BraceMatcherXXX$NodeImpl$$$outer(): lampion.scalax.BraceMatcherXXX = B\
raceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
  def this($outer: lampion.scalax.BraceMatcherXXX): lampion.scalax.BraceMatcherXXX$MatchableX = {
    if ($outer.eq(null))
      throw new java.lang.NullPointerException()
    else
      BraceMatcherXXX$MatchableX.this.$outer = $outer;
    BraceMatcherXXX$MatchableX.super.this();
    BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$NodeImpl]()./*BraceMatcherXXX$N\
odeImpl$class*/$init$();
    BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$Matchable]()./*BraceMatcherXXX$\
Matchable$class*/$init$();
    ()
  }
}
exception when traversing package scalax {
  abstract trait BraceMatcherXXX extends java.lang.Object with scala.ScalaObject;
  abstract trait BraceMatcherXXX$class extends java.lang.Object with scala.ScalaObject with lampion.scalax.Brace\
MatcherXXX {
    def /*BraceMatcherXXX$class*/$init$(): scala.Unit = {
      ()
    }
  };
  abstract trait BraceMatcherXXX$NodeImpl extends java.lang.Object with scala.ScalaObject {
    def scanWithSkip(x$1: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl;
      def lampion$scalax$BraceMatcherXXX$NodeImpl$$$outer(): lampion.scalax.BraceMatcherXXX
  };
  abstract trait BraceMatcherXXX$Matchable extends java.lang.Object with lampion.scalax.BraceMatcherXXX$NodeImpl\
 with scala.ScalaObject {
     def lampion$scalax$BraceMatcherXXX$Matchable$$super$scanWithSkip(x$1: lampion.scalax.HasDirX\
XX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl;
    override def scanWithSkip(x$1: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl;
      def lampion$scalax$BraceMatcherXXX$Matchable$$$outer(): lampion.scalax.BraceMatcherXXX
\

  };
  class BraceMatcherXXX$MatchableX extends java.lang.Object with lampion.scalax.BraceMatcherXXX$Matchable with l\
ampion.scalax.BraceMatcherXXX$NodeImpl with scala.ScalaObject {
    protected   val $outer: lampion.scalax.BraceMatcherXXX = _;
      def lampion$scalax$BraceMatcherXXX$MatchableX$$$outer(): lampion.scalax.BraceMatcherXXX\
 = BraceMatcherXXX$MatchableX.this.$outer;
      def lampion$scalax$BraceMatcherXXX$Matchable$$$outer(): lampion.scalax.BraceMatcherXXX \
= BraceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
      def lampion$scalax$BraceMatcherXXX$NodeImpl$$$outer(): lampion.scalax.BraceMatcherXXX =\
 BraceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
    def this($outer: lampion.scalax.BraceMatcherXXX): lampion.scalax.BraceMatcherXXX$MatchableX = {
      if ($outer.eq(null))
        throw new java.lang.NullPointerException()
      else
        BraceMatcherXXX$MatchableX.this.$outer = $outer;
      BraceMatcherXXX$MatchableX.super.this();
      BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$NodeImpl]()./*BraceMatcherXXX\
$NodeImpl$class*/$init$();
      BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$Matchable]()./*BraceMatcherXX\
X$Matchable$class*/$init$();
      ()
    }
  };
  abstract trait BraceMatcherXXX$NodeImpl$class extends java.lang.Object with object scala.ScalaObject$class wit\
h lampion.scalax.BraceMatcherXXX$NodeImpl {
    def scanWithSkip(dir: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl = null;
    def /*BraceMatcherXXX$NodeImpl$class*/$init$(): scala.Unit = {
      ()
    }
  };
  abstract trait BraceMatcherXXX$Matchable$class extends java.lang.Object with object lampion.scalax.BraceMatche\
rXXX$NodeImpl$class with object scala.ScalaObject$class with lampion.scalax.BraceMatcherXXX$Matchable {
    override def scanWithSkip(dir: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl = Brac\
eMatcherXXX$Matchable$class.this.lampion$scalax$BraceMatcherXXX$Matchable$$super$scanWithSkip(dir);
    def /*BraceMatcherXXX$Matchable$class*/$init$(): scala.Unit = {
      ()
    }
  }
}
exception when traversing package lampion {
  package scalax {
    abstract trait BraceMatcherXXX extends java.lang.Object with scala.ScalaObject;
    abstract trait BraceMatcherXXX$class extends java.lang.Object with scala.ScalaObject with lampion.scalax.Bra\
ceMatcherXXX {
      def /*BraceMatcherXXX$class*/$init$(): scala.Unit = {
        ()
      }
    };
    abstract trait BraceMatcherXXX$NodeImpl extends java.lang.Object with scala.ScalaObject {
      def scanWithSkip(x$1: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl;
        def lampion$scalax$BraceMatcherXXX$NodeImpl$$$outer(): lampion.scalax.BraceMatcherXXX\

    };
    abstract trait BraceMatcherXXX$Matchable extends java.lang.Object with lampion.scalax.BraceMatcherXXX$NodeIm\
pl with scala.ScalaObject {
       def lampion$scalax$BraceMatcherXXX$Matchable$$super$scanWithSkip(x$1: lampion.scalax.HasDi\
rXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl;
      override def scanWithSkip(x$1: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl;
        def lampion$scalax$BraceMatcherXXX$Matchable$$$outer(): lampion.scalax.BraceMatcherXX\
X
    };
    class BraceMatcherXXX$MatchableX extends java.lang.Object with lampion.scalax.BraceMatcherXXX$Matchable with\
 lampion.scalax.BraceMatcherXXX$NodeImpl with scala.ScalaObject {
      protected   val $outer: lampion.scalax.BraceMatcherXXX = _;
        def lampion$scalax$BraceMatcherXXX$MatchableX$$$outer(): lampion.scalax.BraceMatcherX\
XX = BraceMatcherXXX$MatchableX.this.$outer;
        def lampion$scalax$BraceMatcherXXX$Matchable$$$outer(): lampion.scalax.BraceMatcherXX\
X = BraceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
        def lampion$scalax$BraceMatcherXXX$NodeImpl$$$outer(): lampion.scalax.BraceMatcherXXX\
 = BraceMatcherXXX$MatchableX.this.lampion$scalax$BraceMatcherXXX$MatchableX$$$outer();
      def this($outer: lampion.scalax.BraceMatcherXXX): lampion.scalax.BraceMatcherXXX$MatchableX = {
        if ($outer.eq(null))
          throw new java.lang.NullPointerException()
        else
          BraceMatcherXXX$MatchableX.this.$outer = $outer;
        BraceMatcherXXX$MatchableX.super.this();
        BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$NodeImpl]()./*BraceMatcherX\
XX$NodeImpl$class*/$init$();
        BraceMatcherXXX$MatchableX.this.$asInstanceOf[lampion.scalax.BraceMatcherXXX$Matchable]()./*BraceMatcher\
XXX$Matchable$class*/$init$();
        ()
      }
    };
    abstract trait BraceMatcherXXX$NodeImpl$class extends java.lang.Object with object scala.ScalaObject$class w\
ith lampion.scalax.BraceMatcherXXX$NodeImpl {
      def scanWithSkip(dir: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl = null;
      def /*BraceMatcherXXX$NodeImpl$class*/$init$(): scala.Unit = {
        ()
      }
    };
    abstract trait BraceMatcherXXX$Matchable$class extends java.lang.Object with object lampion.scalax.BraceMatc\
herXXX$NodeImpl$class with object scala.ScalaObject$class with lampion.scalax.BraceMatcherXXX$Matchable {
      override def scanWithSkip(dir: lampion.scalax.HasDirXXX$Dir): lampion.scalax.BraceMatcherXXX$NodeImpl = Br\
aceMatcherXXX$Matchable$class.this.lampion$scalax$BraceMatcherXXX$Matchable$$super$scanWithSkip(dir);
      def /*BraceMatcherXXX$Matchable$class*/$init$(): scala.Unit = {
        ()
      }
    }
  }
}
Exception in thread "main" java.lang.AssertionError: assertion failed: method scanWithSkip:(lampion.scalax.HasDi\
rXXX$Dir)lampion.scalax.BraceMatcherXXX$NodeImpl trait BraceMatcherXXX$NodeImpl object BraceMatcherXXX$NodeImpl$\
class method scanWithSkip (lampion.scalax.BraceMatcherXXX$NodeImpl,lampion.scalax.HasDirXXX$Dir)lampion.scalax.B\
raceMatcherXXX$NodeImpl  (lampion.scalax.HasDirXXX$Dir)lampion.scalax.BraceMatcherXXX$NodeImpl cleanup
	at scala.Predef$.assert(Predef.scala:100)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.staticCall$0(Mixin.scala:586)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.scala$tools$nsc$transform$Mixin$MixinTransformer$$postTrans\
form(Mixin.scala:611)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$30.apply(Mixin.scala:662)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$30.apply(Mixin.scala:662)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:71)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:662)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$19.apply(Mixin.scala:480)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$19.apply(Mixin.scala:480)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:71)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.completeSuperAccessor$0(Mixin.scala:480)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$26.apply(Mixin.scala:531)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$26.apply(Mixin.scala:531)
	at scala.List.map(List.scala:663)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.addNewDefs(Mixin.scala:531)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.scala$tools$nsc$transform$Mixin$MixinTransformer$$postTrans\
form(Mixin.scala:565)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$30.apply(Mixin.scala:662)
	at scala.tools.nsc.transform.Mixin$MixinTransformer$$anonfun$30.apply(Mixin.scala:662)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:71)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:662)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1169)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1069)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1068)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1189)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1067)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:661)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1183)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1181)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.List$.loop$0(List.scala:247)
	at scala.List$.mapConserve(List.scala:260)
	at scala.List$.loop$0(List.scala:247)
	at scala.List$.mapConserve(List.scala:260)
	at scala.List$.loop$0(List.scala:247)
	at scala.List$.mapConserve(List.scala:260)
	at scala.List$.loop$0(List.scala:247)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1181)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1064)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1064)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1189)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1063)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:661)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1183)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1181)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1181)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1064)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1064)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1189)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1063)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:661)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1184)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:219)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:208)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:208)
	at scala.Iterator$class.foreach(Iterator.scala:319)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:244)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:208)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:473)
	at scala.tools.nsc.Global$Run.compile(Global.scala:542)
	at scala.tools.nsc.Main$.process(Main.scala:74)
	at scala.tools.nsc.Main$.main(Main.scala:96)
	at scala.tools.nsc.Main.main(Main.scala)
sean-mcdirmid:~/workspace/lampion/src mcdirmid$
Note that the argument scanWithSkip has to refer to Dir which must be defined in a separate file (otherwise ther\ e is no crash). The crash is also avoided if the super call is not made. Weird
what expected For the compiler to stop crashing so much so I can get some work done.
[back to overview]
Changes of this bug report
Martin  edited on  2006-11-11 21:32:36.0