Fix resolve of last destructuring declaration in block
Last declaration in block is resolved in DEPENDENT mode because it has influence on return type and therefore fake call for destructuring declaration wasn't completed (see `getBlockReturnedTypeWithWritableScope`) Now we resolve fake call for destructuring declaration in INDEPENDENT mode as it doesn't have effect on return type #KT-15480 Fixed
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
||||
|
||||
fun test(list: A) {
|
||||
if (true) {
|
||||
val (c) = list
|
||||
}
|
||||
else {}
|
||||
|
||||
if (true) {
|
||||
Unit
|
||||
val (c) = list
|
||||
}
|
||||
else {}
|
||||
|
||||
when (1) {
|
||||
1 -> {
|
||||
val (c) = list
|
||||
}
|
||||
}
|
||||
|
||||
fn { it ->
|
||||
val (a) = it
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
operator fun component1() = 1
|
||||
}
|
||||
|
||||
fun fn(x: (A) -> Unit) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public fun fn(/*0*/ x: (A) -> kotlin.Unit): kotlin.Unit
|
||||
public fun test(/*0*/ list: A): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public final operator fun component1(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user