b6b132a9a3
The idea is that when we have successful candidates both from smart cast and original type, we should discriminate in the favor of former ones. While this problem (see kt55722.kt) existed before this branch is merged, initially it was recognized on FP Ultimate when we stopped assuming captured types from the same projections as equal (see kt55722Initial.kt). ^KT-55722 Fixed ^KT-55024 Fixed ^KT-56283 Related ^KT-56310 Related
21 lines
342 B
Kotlin
Vendored
21 lines
342 B
Kotlin
Vendored
// SKIP_TXT
|
|
// ISSUE: KT-55024
|
|
// MODULE: a
|
|
interface A {
|
|
fun foo()
|
|
}
|
|
|
|
internal sealed class B(val x: A) : A {
|
|
override fun foo() {}
|
|
fun bar() {}
|
|
}
|
|
|
|
// MODULE: b(a)
|
|
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
|
private fun test_1(x: A) {
|
|
if (x is B) {
|
|
x.foo()
|
|
<!DEBUG_INFO_SMARTCAST!>x<!>.bar()
|
|
}
|
|
}
|