Aladdin - Scala Bugtracking
[#657] project: compiler priority: high category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-07-13 17:36:27.0
subject mixin VerifyError
code
package test;

abstract class BaseList {
  type Node <: NodeImpl;
  implicit def convertNode(ni : NodeImpl) = ni.asInstanceOf[Node];
  abstract class NodeImpl;
}
abstract class LinkedList extends BaseList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;
}
trait OffsetList extends LinkedList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;
}

trait PriorityTree extends BaseList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl {
    def chop : Node = this;
  }
}

trait PrecedenceParser  extends LinkedList with PriorityTree {
  type Node <: NodeImpl;
  trait NodeImpl extends super[LinkedList].NodeImpl with super[PriorityTree].NodeImpl;
}

trait Matcher extends PrecedenceParser {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;

  type Matchable <: Node with MatchableImpl;
  implicit def convertMatchable(m : MatchableImpl) = m.asInstanceOf[Matchable];
  trait MatchableImpl extends NodeImpl {
    override def chop : Node = super.chop;
  }
}

class Test extends OffsetList with Matcher {
  type Node = NodeImpl;
  trait NodeImpl extends super[OffsetList].NodeImpl with super[Matcher].NodeImpl;
  class MatchableImpl extends super.MatchableImpl with NodeImpl;
  type Matchable = MatchableImpl;
}

object test extends Application {
  val test = new Test;
  val m = new test.MatchableImpl;
  m.chop;
}
what happened
Exception in thread "main" java.lang.VerifyError: (class: test/Test$MatchableImpl, method: test$Matcher$Matchabl\
eImpl$$super$chop signature: ()Ltest/Matcher$NodeImpl;) Illegal use of nonvirtual function call
	at test.test$.(test.scala:52)
	at test.test$.(test.scala)
	at test.test.main(test.scala)
In Matchable.MatchableImpl.super$chop, a non-virtual call is being generated to a method in a class that is not \ extended.
what expected
[back to overview]
Changes of this bug report
Martin  edited on  2006-07-14 15:19:06.0