scala-ide / scala-worksheet

A Scala IDE plugin for a multi-line REPL (called worksheet)
96 stars 24 forks source link

Overloads not supported in the worksheet #96

Open dragos opened 11 years ago

dragos commented 11 years ago

Overloads are not supported by the instrumenter:

class C {
  def foo[A](x: Int, y: String) = println("foo")
  def foo[A](x: Int) = println("overloaded foo")

  foo(10)
}

gives the following instrumented code:

object scratch {;import scala.runtime.WorksheetSupport._; def main(args: Array[String])=$execute{;$skip(183); 

  def foo[A](x: Int, y: String = "abc") = println("foo");System.out.println("""foo: [A](x: Int, y: String)Unit""");$skip(49); 
  def foo[A](x: Int) = println("overloaded foo");System.out.println("""foo: [A](x: Int)Unit""");$skip(10); 
  foo(10)}

}

and the error:

method foo is defined twice