Aladdin - Scala Bugtracking
[#318] project: compiler priority: low category: bug
submitter assigned to status date submitted
Philippe Philippe fixed 2004-04-13 14:03:29.0
subject Inner classes of objects declared in a function crash the compiler
code
object Test {
  def fun: Int = {
    object o {
      def a: Int = 1;
      class C { def b: Int =  a; }
    }
    0
  }
}
what happened
Exception in thread "main" java.lang.AssertionError: 
unit        : tmp/test.scala
clasz       : Test.o$0.C$class
member      : Test.o$0.C$class.b
owner       : Test.o$0.C$class.b
tree        : Test.Test$o$1.a
tree.pos    : 5:31
tree.symbol : Test.o$0.a
tree.type   : ()Int
	at scalac.checkers.TreeChecker.selection(TreeChecker.java:390)
	at scalac.checkers.TreeChecker.function(TreeChecker.java:343)
	at scalac.checkers.TreeChecker.expression(TreeChecker.java:284)
	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.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:371)
	at scalac.Global.compile(Global.java:343)
	at scala.tools.scalac.Main$.main1(Main.scala:35)
	at scala.tools.scalac.Main$.main(Main.scala:27)
	at scala.tools.scalac.Main.main(Main.scala:27)
what expected No error. The problem is caused by phase ExplicitOuter which tries to replace the reference to the outer class o.this in method b by a reference to the outer object o.
[back to overview]
Changes of this bug report
Philippe  edited on  2004-04-13 16:14:53.0
Fixed ExplicitOuter