[NI] Fix not-null smartcast on intersection of nullable types

#KT-28670 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-12-06 17:47:33 +03:00
parent 383c2d1bff
commit 6ebbb6eae3
6 changed files with 48 additions and 3 deletions
@@ -0,0 +1,18 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A
interface B {
fun test() {}
}
fun <K> select(a: K, b: K): K = a
fun test(a: A?, b: B?) {
b as A?
a as B?
val c = select(a, b)
if (c != null) {
<!DEBUG_INFO_SMARTCAST!>c<!>.test()
}
}
@@ -0,0 +1,17 @@
package
public fun </*0*/ K> select(/*0*/ a: K, /*1*/ b: K): K
public fun test(/*0*/ a: A?, /*1*/ b: B?): kotlin.Unit
public interface A {
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 interface B {
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 fun test(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}