Aladdin - Scala Bugtracking
[#174] project: compiler priority: low category: bug
submitter assigned to status date submitted
Philippe Philippe fixed 2003-10-02 13:23:14.0
subject AbstractMethodError with classes nested in a class with type parameters
code
class Foo[X] {

  class Tree;
  class Node extends Tree;


  val inner:Inner = new SubInner;

  trait Inner {
    def test: Foo[X]#Tree /* -> Tree[outer$X#1] */ ;
  }

  class SubInner extends Inner {
    def test /*: Foo.this.Node -> Node[outer$X#2]*/ = new Node;
  }

}

object Test {
  def main(args: Array[String]): Unit = {
    (new Foo[Int]).inner.test;
    ()
  }
}
what happened

Raised following exception at runtime:

Exception in thread "main" java.lang.AbstractMethodError: Foo$SubInner$class.test()LFoo$Tree;
        at Test$.main(/home/paltherr/work/scala-short/test/tmp/test.scala:22)
        at Test.main(/home/paltherr/work/scala-short/test/tmp/test.scala)
what expected

The program should run without any error.

[back to overview]
Changes of this bug report
Philippe  edited on  2003-10-02 13:30:21.0

The main problem was that method SubInner had type Foo.this.Node even after phase ExplicitOuter where ThisTypes to outer classes are completly meainingless. The solution was to change phase ExplicitOuter to replace all prefixes of TypeRefs by localThisTypes. This also required the addition of a primary constructor to AbsTypeSymbols.