Refine 'isMoreSpecific' calculation
Choose member with better visibility, it's needed for proper calculation of types intersection member scope #KT-10481 Fixed
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
open class A {
|
||||
open var value: Int = 4
|
||||
protected set
|
||||
}
|
||||
|
||||
class MutableA : A() {
|
||||
override var value: Int = 4
|
||||
public set
|
||||
}
|
||||
|
||||
fun test(myA: A) {
|
||||
if (myA is MutableA) {
|
||||
<!DEBUG_INFO_SMARTCAST!>myA<!>.value = 5
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public fun test(/*0*/ myA: A): kotlin.Unit
|
||||
|
||||
public open class A {
|
||||
public constructor A()
|
||||
public open var value: 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
|
||||
}
|
||||
|
||||
public final class MutableA : A {
|
||||
public constructor MutableA()
|
||||
public open override /*1*/ var value: 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
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
abstract class A {
|
||||
abstract protected fun foo(): String
|
||||
abstract protected val bar: String
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(): String
|
||||
val bar: String
|
||||
}
|
||||
|
||||
fun test(x: A) {
|
||||
if (x is B) {
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.foo()
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.bar
|
||||
}
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
public fun test(/*0*/ x: A): kotlin.Unit
|
||||
|
||||
public abstract class A {
|
||||
public constructor A()
|
||||
protected abstract val bar: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected abstract fun foo(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B {
|
||||
public abstract val bar: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.String
|
||||
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