You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deffn2(arg: String, arg2: String)(f: String=>Unit):Unit=
f(arg)
// doesn't compile
fn2(
arg ="blue sleeps faster than tuesday",
arg2 ="the quick brown fox jumped over the lazy dog"): env =>valx= env
println(x)
// does compile
fn2(
arg ="blue sleeps faster than tuesday",
arg2 ="the quick brown fox jumped over the lazy dog"):
env =>valx= env
println(x)
// does compile
fn2(
arg ="blue sleeps faster than tuesday",
arg2 ="the quick brown fox jumped over the lazy dog"
): env =>valx= env
println(x)
Output
scastie marks two errors:
fn2 line with not a legal formal parameter for a function literal
val x = env line with Not found: env
Expectation
According to the documentation, the first argument clause (with arg and arg2) does not start an indentation region, hence as long as the lambda body is indented relative to fn2 invocation, it should work.
Compiler version
Minimized code
Output
scastie marks two errors:
fn2
line withnot a legal formal parameter for a function literal
val x = env
line withNot found: env
Expectation
According to the documentation, the first argument clause (with
arg
andarg2
) does not start an indentation region, hence as long as the lambda body is indented relative tofn2
invocation, it should work.P.S. The problem was first reported in scalameta/scalafmt#4569.
The text was updated successfully, but these errors were encountered: