Files
kotlin-fork/compiler/testData/diagnostics/tests/shadowing/ShadowLambdaParameter.kt
T
Kirill Rakhman 8de36c416e [RAW FIR] Put destructuring statements outside of main lambda block
This fixes a false positive REDECLARATION when you want to shadow
a destructured lambda parameter inside the lambda.

#KT-60771 Fixed
2023-08-24 11:07:45 +00:00

18 lines
425 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
fun foo1(i: (Int) -> Unit) {}
fun foo2(i: (Int, Int) -> Unit) {}
fun foo3(i: (Pair) -> Unit) {}
fun bar(x: Int, y: Int) {
foo1 { <!NAME_SHADOWING!>x<!> -> x }
foo2 { <!NAME_SHADOWING!>x<!>: Int, <!NAME_SHADOWING!>y<!>: Int ->
val <!NAME_SHADOWING!>x<!> = x
}
foo3 { (x, y) ->
val <!NAME_SHADOWING!>x<!> = x
}
}
data class Pair(val a: Int, val b: Int)