Aladdin - Scala Bugtracking
[#937] project: specification priority: low category: bug
submitter assigned to status date submitted
Sean Martin won't fix 2007-02-11 15:27:26.0
subject companion module members not imported into class or subclasses
code
object AbstractGame {
  protected val MAGICAL_CONSTANTS_FOR_SUBCLASSES = 42;
}
abstract class AbstractGame {
  // import AbstractGame._;
  MAGICAL_CONSTANTS_FOR_SUBCLASSES;
}
what happened
won't compile
what expected I thought the members of a companion module are supposed to be auto-imported. If we want static fields to behave like they do in Java, the companion module would have to be imported into sub-classes also.
[back to overview]
Changes of this bug report
Martin  edited on  2007-03-08 10:51:48.0
I believe the premise of the bug does not hold: we do not necessarily want fields in companion objects to behave 100% like Java statics. Unlike the static protected problem, this one's easily worked around. So let's let it go.