[NI] Fix issue with returning non-deparenthesized lambdas from labmdas

#KT-36080 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-01-22 20:25:33 +03:00
parent 6b07ef42dd
commit f1d9177112
9 changed files with 91 additions and 7 deletions
@@ -0,0 +1,29 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
val x1: (String) -> Unit = run {
lambda@{ foo ->
bar(foo)
}
}
val x2: (String) -> Unit = run {
({ foo ->
bar(foo)
})
}
val x3: (String) -> Unit = run {
(lambda@{ foo ->
bar(foo)
})
}
val x4: (String) -> Unit = run {
return@run (lambda@{ foo ->
bar(foo)
})
}
fun bar(s: String) {}
fun <R> run(block: () -> R): R = block()