-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
The following code causes a compilation error:
object Foo {
def foo(x: Int, y: Int = 10) = x*y
lazy val y = foo(x = 20)
}The error is as follows:
innocuous.scala:3: error: variable definition needs type because 'y' is used as a named argument in its body.
Error occurred in an application involving default arguments.
lazy val y = foo(x = 20)
^
one error foundNone of the following fail in the same way:
val y = foo(x = 20)OR
lazy val y = foo(20)It appears that combining the lazy modifier on y with a named arg in the application of foo causes it to blow up.