Aladdin - Scala Bugtracking
[#199] project: compiler priority: low category: bug
submitter assigned to status date submitted
Vincent Martin fixed 2003-10-17 13:31:27.0
subject object in class
code
class C { object o; }

object objectInClass {
  def main(args: Array[String]) = {
    (new C).o; ()
  }
}
what happened
At runtime :
Exception in thread "main" java.lang.NoSuchFieldError: o$
        at C$class.o(objectInClass.scala:1)
        at objectInClass$.main(objectInClass.scala:5)
        at objectInClass.main(objectInClass.scala)
what expected No runtime error.
[back to overview]
Changes of this bug report
Michel  edited on  2003-10-21 09:25:34.0

The problem here is that the variable which holds the object instance is not put in the members of the class objectInClass, it only exists in the tree. Therefore, AddInterfaces (which looks only at class members) doesn't see it, and doesn't leave it in the class.

To fix this bug, RefCheck should be fixed to include the variables it creates to store nested object's instances in the members of the enclosing class.

Martin  edited on  2003-10-21 15:06:20.0
Martin  edited on  2003-10-21 15:06:30.0