Aladdin - Scala Bugtracking
[#874] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin fixed 2007-01-08 14:03:32.0
subject case class factory methods missing....
code
object Test {
  abstract class Base {
    type T;
    def T : T;
    T;
  }
  class Mix extends Base { case class T; }
  def main(args : Array[String]) : Unit = {
    val obvious = new Mix;
  }
}
what happened
Compiles fine: Mix is not abstract because def T in Base is defined by the case class factory method implemented\
 in Mix. However, on run we get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: test.Test$Mix.T()Ltest/Test$Mix$T;
	at test.Test$Base.T(Test.scala:13)
	at test.Test$Base$class.$init$(Test.scala:7)
	at test.Test$Base.(Test.scala:13)
	at test.Test$.main(Test.scala:15)
	at test.Test.main(Test.scala)
I guess the back-end forgot not to generate the T factory method that was promised during type checking. Weird, \ its like the back-end never generates case class factory methods, which is definitely incorrect since being type\ s as methods they can "by-name" implement abstract methods (behavior that I actually depend on). I disassembled \ some of the code and if a case class is created through its factory method, then the back-end emits a new call, \ not a call to the factory method, which is also very incorrect because the factory method can always be overridd\ en..... Not sure if this is a new problem or old problem, I could have sworn this worked before my pull last week, but n\ o solid evidence.
what expected
[back to overview]
Changes of this bug report
Sean  edited on  2007-01-08 14:03:46.0
Burak  edited on  2007-01-08 16:50:25.0
Martin  edited on  2007-01-10 20:52:40.0