Check lambda parameter for name shadowing
#KT-5160 Fixed
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// !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<!> -> <!UNUSED_EXPRESSION!>x<!> }
|
||||
foo2 { <!NAME_SHADOWING!>x<!>: Int, <!NAME_SHADOWING!>y<!>: Int -> x + y }
|
||||
foo3 { (x, y) -> x + y }
|
||||
}
|
||||
|
||||
data class Pair(val a: Int, val b: Int)
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit
|
||||
public fun foo1(/*0*/ i: (kotlin.Int) -> kotlin.Unit): kotlin.Unit
|
||||
public fun foo2(/*0*/ i: (kotlin.Int, kotlin.Int) -> kotlin.Unit): kotlin.Unit
|
||||
public fun foo3(/*0*/ i: (Pair) -> kotlin.Unit): kotlin.Unit
|
||||
|
||||
public final data class Pair {
|
||||
public constructor Pair(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int)
|
||||
public final val a: kotlin.Int
|
||||
public final val b: kotlin.Int
|
||||
public final operator /*synthesized*/ fun component1(): kotlin.Int
|
||||
public final operator /*synthesized*/ fun component2(): kotlin.Int
|
||||
public final /*synthesized*/ fun copy(/*0*/ a: kotlin.Int = ..., /*1*/ b: kotlin.Int = ...): Pair
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fun ff(): Int {
|
||||
var i = 1
|
||||
<!UNUSED_LAMBDA_EXPRESSION!>{ i: Int -> i }<!>
|
||||
<!UNUSED_LAMBDA_EXPRESSION!>{ <!NAME_SHADOWING!>i<!>: Int -> i }<!>
|
||||
return i
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user