Support smart casts for functions of local variable delegates

This commit is contained in:
Alexander Udalov
2016-06-27 18:38:25 +03:00
parent 70a994b135
commit 4a05c749b5
5 changed files with 82 additions and 28 deletions
@@ -0,0 +1,15 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
interface A {
operator fun getValue(x: Any?, y: Any?): Any?
}
interface B : A {
override fun getValue(x: Any?, y: Any?): Int
}
fun test(a: A) {
if (a is B) {
val x: Int by <!DEBUG_INFO_SMARTCAST!>a<!>
}
}
@@ -0,0 +1,17 @@
package
public fun test(/*0*/ a: A): kotlin.Unit
public interface A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract operator fun getValue(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any?): kotlin.Any?
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface B : A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*1*/ fun getValue(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any?): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}