Aladdin - Scala Bugtracking
[#856] project: compiler priority: high category: bug
submitter assigned to status date submitted
Burak Martin fixed 2006-11-30 16:51:33.0
subject typer too liberal: a constructor parameter must not automatically implement trait method
code
trait Complex extends Product2[double,double] 

class ComplexRect(val _1:double, _2:double) extends Complex {
  override def toString = "ComplexRect("+_1+","+_2+")"
}

object Test {
  def main(args:Array[String]) = {
    new ComplexRect(1,1)._2
  }
}
what happened
compiles silently, and then execution 
[emir@lamppc31 scala]$ build/quick/bin/scala -classpath /tmp Test
java.lang.AbstractMethodError: ComplexRect._2()Ljava/lang/Object;
        at Test$.main(bugAbstract.scala:9)
what expected this thing compiles, probably because the constructor parameter _2 has the right *name*, however, it is invisible from the outside.
[back to overview]
Changes of this bug report
Martin  edited on  2006-11-30 17:13:29.0