KT-3919 Automatic labeling of lambdas by receiving functions

#KT-3919 Fixed
This commit is contained in:
Andrey Breslav
2013-08-22 14:27:01 +04:00
parent 07a8dff5f4
commit 55eb994502
5 changed files with 98 additions and 0 deletions
@@ -0,0 +1,19 @@
fun box(): String {
val a = 1
val explicitlyReturned = run1 {(): String ->
if (a > 0)
return@run1 "OK"
else "Fail 1"
}
if (explicitlyReturned != "OK") return explicitlyReturned
val implicitlyReturned = run1 {(): String ->
if (a < 0)
return@run1 "Fail 2"
else "OK"
}
if (implicitlyReturned != "OK") return implicitlyReturned
return "OK"
}
fun run1<T>(f: () -> T): T { return f() }