K2: add test for KT-57649

This commit is contained in:
Mikhail Glukhikh
2023-03-29 11:57:52 +02:00
committed by Space Team
parent 0dbf218f0b
commit 2e69c643cb
7 changed files with 46 additions and 0 deletions
@@ -0,0 +1,8 @@
// ISSUE: KT-57649
open class A
abstract class B {
fun test(current: A): A? =
// K2 reports empty intersection here due to the smart cast from A to B, where A & B aren't compatible
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING("K; B?, A?; multiple incompatible classes; : B, A")!>if (current === this) current else null<!>
}
@@ -0,0 +1,8 @@
// ISSUE: KT-57649
open class A
abstract class B {
fun test(current: A): A? =
// K2 reports empty intersection here due to the smart cast from A to B, where A & B aren't compatible
if (current === this) current else null
}