[FIR] Don't call componentX for anonymous destructuring entry
This commit is contained in:
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class A {
|
||||
operator fun component1() = "O"
|
||||
operator fun component2(): String = throw RuntimeException("fail 0")
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class A {
|
||||
operator fun component1() = "O"
|
||||
operator fun component2(): String = throw RuntimeException("fail 0")
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ fun useDeclaredVariables() {
|
||||
}
|
||||
|
||||
fun checkersShouldRun() {
|
||||
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>for ((<!UNRESOLVED_REFERENCE!>@A a<!>, <!UNRESOLVED_REFERENCE!>_<!>)<!SYNTAX!><!>) {
|
||||
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>for ((<!UNRESOLVED_REFERENCE!>@A a<!>, _)<!SYNTAX!><!>) {
|
||||
|
||||
}<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun useDeclaredVariables() {
|
||||
}
|
||||
|
||||
fun checkersShouldRun() {
|
||||
val (<!UNRESOLVED_REFERENCE!>@A a<!>, <!UNRESOLVED_REFERENCE!>_<!>) = <!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
val (<!UNRESOLVED_REFERENCE!>@A a<!>, _) = <!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
}
|
||||
|
||||
annotation class A
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun useDeclaredVariables() {
|
||||
}
|
||||
|
||||
fun checkersShouldRun() {
|
||||
<!INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION!>val (<!UNRESOLVED_REFERENCE!>@A a<!>, <!UNRESOLVED_REFERENCE!>_<!>)<!>
|
||||
<!INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION!>val (<!UNRESOLVED_REFERENCE!>@A a<!>, _)<!>
|
||||
}
|
||||
|
||||
annotation class A
|
||||
|
||||
Vendored
+7
-7
@@ -11,31 +11,31 @@ class C {
|
||||
|
||||
fun test() {
|
||||
for ((x, _) in C()) {
|
||||
foo(x, _)
|
||||
foo(x, <!UNRESOLVED_REFERENCE!>_<!>)
|
||||
}
|
||||
|
||||
for ((_, y) in C()) {
|
||||
foo(_, y)
|
||||
foo(<!UNRESOLVED_REFERENCE!>_<!>, y)
|
||||
}
|
||||
|
||||
for ((_, _) in C()) {
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(_, _)
|
||||
foo(<!UNRESOLVED_REFERENCE!>_<!>, <!UNRESOLVED_REFERENCE!>_<!>)
|
||||
}
|
||||
|
||||
for ((_ : Int, _ : String) in C()) {
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(_, _)
|
||||
foo(<!UNRESOLVED_REFERENCE!>_<!>, <!UNRESOLVED_REFERENCE!>_<!>)
|
||||
}
|
||||
|
||||
for ((_ : String, _ : Int) in C()) {
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(_, _)
|
||||
foo(<!UNRESOLVED_REFERENCE!>_<!>, <!UNRESOLVED_REFERENCE!>_<!>)
|
||||
}
|
||||
|
||||
val (x, _) = A()
|
||||
val (_, y) = A()
|
||||
|
||||
foo(x, y)
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(x, _)
|
||||
foo(_, y)
|
||||
foo(x, <!UNRESOLVED_REFERENCE!>_<!>)
|
||||
foo(<!UNRESOLVED_REFERENCE!>_<!>, y)
|
||||
|
||||
val (`_`, z) = A()
|
||||
|
||||
|
||||
Vendored
+10
-10
@@ -8,39 +8,39 @@ fun foo(block: (A) -> Unit) { }
|
||||
|
||||
fun bar() {
|
||||
foo { (_, b) ->
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
b checkType { _<String>() }
|
||||
}
|
||||
|
||||
foo { (a, _) ->
|
||||
a checkType { _<Int>() }
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
}
|
||||
|
||||
foo { (_, _) ->
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
}
|
||||
|
||||
foo { (_: Int, b: String) ->
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
b checkType { _<String>() }
|
||||
}
|
||||
|
||||
foo { (a: Int, _: String) ->
|
||||
a checkType { _<Int>() }
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
}
|
||||
|
||||
foo { (_: Int, _: String) ->
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
}
|
||||
|
||||
foo { (_, _): A ->
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
}
|
||||
|
||||
foo { (`_`, _) ->
|
||||
_ checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Int>() }
|
||||
_ checkType { _<Int>() }
|
||||
}
|
||||
|
||||
foo { (_, `_`) ->
|
||||
@@ -52,12 +52,12 @@ fun bar() {
|
||||
}
|
||||
|
||||
foo { (_: String, b) ->
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
b checkType { _<String>() }
|
||||
}
|
||||
|
||||
foo { (_, b): B ->
|
||||
_.hashCode()
|
||||
<!UNRESOLVED_REFERENCE!>_<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
|
||||
b checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Short>() }
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -31,6 +31,5 @@ object B {
|
||||
fun B.test() {
|
||||
val <destruct>: A = A
|
||||
val x: Int = (<this>, <destruct>).component1()
|
||||
val _: Int = (<this>, <destruct>).component2()
|
||||
val z: Int = (<this>, <destruct>).component3()
|
||||
}
|
||||
|
||||
@@ -64,10 +64,6 @@ FILE fqName:<root> fileName:/destructuringWithUnderscore.kt
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.test' type=<root>.B origin=null
|
||||
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||
VAR name:_ type:kotlin.Int [val]
|
||||
CALL 'public final fun component2 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.test' type=<root>.B origin=null
|
||||
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||
VAR name:z type:kotlin.Int [val]
|
||||
CALL 'public final fun component3 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.test' type=<root>.B origin=null
|
||||
|
||||
@@ -56,7 +56,6 @@ data class A {
|
||||
|
||||
var fn: Function1<A, Int>
|
||||
field = local fun <anonymous>(<destruct>: A): Int {
|
||||
val _: Int = <destruct>.component1()
|
||||
val y: Int = <destruct>.component2()
|
||||
return 42.plus(other = y)
|
||||
}
|
||||
|
||||
@@ -142,9 +142,6 @@ FILE fqName:<root> fileName:/destructuringInLambda.kt
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (<destruct>:<root>.A) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:<destruct> index:0 type:<root>.A
|
||||
BLOCK_BODY
|
||||
VAR name:_ type:kotlin.Int [val]
|
||||
CALL 'public final fun component1 (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
|
||||
$this: GET_VAR '<destruct>: <root>.A declared in <root>.fn.<anonymous>' type=<root>.A origin=null
|
||||
VAR name:y type:kotlin.Int [val]
|
||||
CALL 'public final fun component2 (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
|
||||
$this: GET_VAR '<destruct>: <root>.A declared in <root>.fn.<anonymous>' type=<root>.A origin=null
|
||||
|
||||
Reference in New Issue
Block a user