[NI] Continue resolution after unstable smart cast on receiver
The old inference cosideres candidates with unstable smartcast on receiver unsuccessful, therefore another one may be selected. KT-36264
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
interface Base {
|
||||
val parent: Base
|
||||
}
|
||||
|
||||
class Derived : Base {
|
||||
override val parent: Base
|
||||
get() = TODO()
|
||||
}
|
||||
|
||||
fun test(d: Derived) {
|
||||
when {
|
||||
d.parent is Derived -> d.parent.parent
|
||||
}
|
||||
}
|
||||
|
||||
fun Any?.take() {}
|
||||
class Something {
|
||||
var prop: String? = null
|
||||
|
||||
fun String.take() {}
|
||||
|
||||
fun test() {
|
||||
if (prop is String) {
|
||||
prop.take()
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
interface Base {
|
||||
val parent: Base
|
||||
}
|
||||
|
||||
class Derived : Base {
|
||||
override val parent: Base
|
||||
get() = TODO()
|
||||
}
|
||||
|
||||
fun test(d: Derived) {
|
||||
when {
|
||||
d.parent is Derived -> d.parent.parent
|
||||
}
|
||||
}
|
||||
|
||||
fun Any?.take() {}
|
||||
class Something {
|
||||
var prop: String? = null
|
||||
|
||||
fun String.take() {}
|
||||
|
||||
fun test() {
|
||||
if (prop is String) {
|
||||
prop.take()
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public fun test(/*0*/ d: Derived): kotlin.Unit
|
||||
public fun kotlin.Any?.take(): kotlin.Unit
|
||||
|
||||
public interface Base {
|
||||
public abstract val parent: Base
|
||||
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
|
||||
}
|
||||
|
||||
public final class Derived : Base {
|
||||
public constructor Derived()
|
||||
public open override /*1*/ val parent: Base
|
||||
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
|
||||
}
|
||||
|
||||
public final class Something {
|
||||
public constructor Something()
|
||||
public final var prop: kotlin.String?
|
||||
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 final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final fun kotlin.String.take(): kotlin.Unit
|
||||
}
|
||||
Reference in New Issue
Block a user