-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Milestone
Description
I'm using Scala 2.12.4.
def test(data: Int): Int = { data + 2 }
def main(): Unit = {
val result = test(data = 3)
val data = "some string" + result
}
The above fails the compilation with:
[error] /somepathwithline: recursive value result needs type
[error] val data = "some string" + result
[error] ^
[error] one error found
[error] (Test / compileIncremental) Compilation failed
But the belows work fine.
def test(data: Int): Int = { data + 2 }
def main(): Unit = {
val result = test(3) // Please notice that `data =` is removed.
val data = "some string" + result
}
def test(data: Int): Int = { data + 2 }
def main(): Unit = {
val result = test(data = 3)
val otherName = "some string" + result // Please notice that this variable isn't `data`
}