Files
kotlin/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambda.kt
2015-04-29 16:33:24 +02:00

18 lines
325 B
Kotlin
Vendored

// !CHECK_TYPE
fun test(bal: Array<Int>) {
var bar = 4
val a = { bar += 4 }
checkSubtype<() -> Unit>(a)
val b = { bar = 4 }
checkSubtype<() -> Unit>(b)
val c = { bal[2] = 3 }
checkSubtype<() -> Unit>(c)
val d = run { bar += 4 }
checkSubtype<Unit>(d)
}
fun <T> run(f: () -> T): T = f()