Closed
Description
I also created a scastie link with the code.
object Main {
def main(args: Array[String]) = println("")
object Foo {
def apply(t : Any)(block: => Unit) : Unit = {}
def foo(t : Any)(block: => Unit) : Unit = {}
}
object Test {
Foo(1){} //OK
Foo.foo(1) {} //OK
Foo foo(1) {} //overloaded or recursive method needs return type
}
}
Using -Xprint:parser
, gives the following:
parsed:
package {
module object Main extends {
def main( args: Array[String]) = println("")
module object Foo extends {
def apply( t: Any)( block: => Unit): Unit =
{
}
def foo( t: Any)( block: => Unit): Unit =
{
}
}
module object Test extends {
Foo(1)(
{
}
)
Foo.foo(1)(
{
}
)
Foo foo
(1)(
{
}
)
}
}
}