Aladdin - Scala Bugtracking
[#360] project: compiler priority: high category: bug
submitter assigned to status date submitted
Martin Philippe fixed 2004-08-26 08:51:57.0
subject Checker complains after MakeBoxingExplicit
code
abstract class A: C {
  def f: String = "hello";
}
abstract class B: C {
  object d {
    System.out.println(f);
  }
}
abstract class C extends A with B;
what happened
Exception in thread "main" java.lang.AssertionError:
unit        : test/nsc2.scala
clasz       : B.d
member      : B.d.
owner       : B.d.
tree        : outer$0$B.f
tree.pos    : 6:24
tree.symbol : A.f
tree.type   : ()String#outer$0$B$B/class A
        at scalac.checkers.TreeChecker.selection(TreeChecker.java:396)
        at scalac.checkers.TreeChecker.function(TreeChecker.java:350)
        at scalac.checkers.TreeChecker.expression(TreeChecker.java:289)
        at scalac.checkers.TreeChecker.vapply(TreeChecker.java:332)
        at scalac.checkers.TreeChecker.expression(TreeChecker.java:281)
        at scalac.checkers.TreeChecker.statement(TreeChecker.java:199)
        at scalac.checkers.TreeChecker.expression(TreeChecker.java:233)
        at scalac.checkers.TreeChecker.statement(TreeChecker.java:199)
        at scalac.checkers.TreeChecker.expression(TreeChecker.java:233)
        at scalac.checkers.TreeChecker.member(TreeChecker.java:168)
        at scalac.checkers.TreeChecker.member(TreeChecker.java:135)
        at scalac.checkers.TreeChecker.template(TreeChecker.java:111)
        at scalac.checkers.TreeChecker.member(TreeChecker.java:147)
        at scalac.checkers.TreeChecker.member(TreeChecker.java:135)
        at scalac.checkers.TreeChecker.template(TreeChecker.java:111)
        at scalac.checkers.TreeChecker.template(TreeChecker.java:91)
        at scalac.checkers.TreeChecker.check(TreeChecker.java:81)
        at scalac.transformer.MakeBoxingExplicitPhase.apply(MakeBoxingExplicitPhase.java:46)
        at scalac.Global.compile(Global.java:386)
        at scalac.Global.compile(Global.java:356)
        at scala.tools.scalac.Main$.main1(Main.scala:42)
        at scala.tools.scalac.Main$.main(Main.scala:28)
        at scala.tools.scalac.Main.main(Main.scala:28)
what expected Succesful compilation. I think the problem is that the system forgets about self types after erasure. Therefore, function `f' ceases to be visible in class `B'. Surprisingly, the program compiles as long as access to `f' in `B' is outside the module `d'.
[back to overview]
Changes of this bug report
Philippe  edited on  2004-08-26 11:30:11.0
Replaced a type() by a typeOfThis() in ExplicitOuter.
Philippe  edited on  2004-08-26 11:30:23.0
Replaced a type() by a typeOfThis() in ExplicitOuter.