Files
kotlin-fork/compiler/testData/diagnostics/tests/labels/labelToOuterLambda.kt
T
2023-04-20 11:05:02 +00:00

35 lines
694 B
Kotlin
Vendored

// FIR_IDENTICAL
// ISSUE: KT-57880, KT-58076
// DIAGNOSTICS: -UNUSED_VARIABLE, -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
fun outerLambda(action: String.() -> Unit) {}
var lambda: Int.() -> Unit = {}
fun consume(arg: String) {}
fun consumeInt(arg: Int) {}
fun main() {
outerLambda {
lambda = {
consume(this@outerLambda)
}
}
outerLambda {
lambda = innerLambda@{
consumeInt(this@innerLambda)
}
}
lateinit var c: Int.() -> Unit
val a = "hello".apply {
val b: Int.() -> Unit = {
this@apply.hello()
}
c = {
this@apply.hello()
}
}
}
fun String.hello() = this