Aladdin - Scala Bugtracking
[#1102] project: compiler priority: high category: bug
submitter assigned to status date submitted
Sean Martin fixed 2007-05-11 13:04:32.0
subject un-annotated overloading very broken
code
package test;
object Foo {
  object node {
    def unlink(until : String) = {
      unlink
      () // needed otherwise will crash
    }
    def unlink : Unit = {}
  }
  def main(args : Array[String]) : Unit = node.unlink("")
}
what happened
Compiles fine. On run:

Exception in thread "main" java.lang.ClassCastException: scala.runtime.BoxedUnit
	at test.Foo$node$.unlink(Foo.scala:5)
	at test.Foo$.main(Foo.scala:10)
	at test.Foo.main(Foo.scala)
what expected Compile error. unlink call in unlink/1 should resolve to unlink/0, not unlink/1 (know this because clicking the unlink call in unlink/1 jumps to unlink/1, not unlink/0).
[back to overview]
Changes of this bug report
Martin  edited on  2007-05-29 16:16:23.0