[NI] Record DFI for callable reference arguments

#KT-31941 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-06-17 16:40:50 +03:00
parent 1f70284b18
commit 8fe632f52b
9 changed files with 119 additions and 14 deletions
@@ -0,0 +1,16 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty1
class DTO {
val q: Int = 0
operator fun get(prop: KProperty1<*, Int>): Int = 0
}
fun foo(intDTO: DTO?, p: KProperty1<*, Int>) {
if (intDTO != null) {
<!DEBUG_INFO_SMARTCAST!>intDTO<!>[DTO::q]
<!DEBUG_INFO_SMARTCAST!>intDTO<!>.q
}
}
@@ -0,0 +1,12 @@
package
public fun foo(/*0*/ intDTO: DTO?, /*1*/ p: kotlin.reflect.KProperty1<*, kotlin.Int>): kotlin.Unit
public final class DTO {
public constructor DTO()
public final val q: kotlin.Int = 0
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun get(/*0*/ prop: kotlin.reflect.KProperty1<*, kotlin.Int>): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,23 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty1
import kotlin.reflect.KMutableProperty1
class Inv<T> {
val size: Int = 0
}
class DTO<T> {
val test: Inv<T>? = null
var q: Int = 0
operator fun <R> get(prop: KProperty1<*, R>): R = TODO()
operator fun <R> set(prop: KMutableProperty1<*, R>, value: R) { }
}
fun main(intDTO: DTO<Int>?) {
if (intDTO != null) {
<!DEBUG_INFO_SMARTCAST!>intDTO<!>[DTO<Int>::q] = <!DEBUG_INFO_SMARTCAST!>intDTO<!>[DTO<Int>::test]!!.size
<!DEBUG_INFO_SMARTCAST!>intDTO<!>[DTO<Int>::q] = <!DEBUG_INFO_SMARTCAST!>intDTO<!>[DTO<Int>::test]!!.size
}
}
@@ -0,0 +1,22 @@
package
public fun main(/*0*/ intDTO: DTO<kotlin.Int>?): kotlin.Unit
public final class DTO</*0*/ T> {
public constructor DTO</*0*/ T>()
public final var q: kotlin.Int
public final val test: Inv<T>? = null
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun </*0*/ R> get(/*0*/ prop: kotlin.reflect.KProperty1<*, R>): R
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final operator fun </*0*/ R> set(/*0*/ prop: kotlin.reflect.KMutableProperty1<*, R>, /*1*/ value: R): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inv</*0*/ T> {
public constructor Inv</*0*/ T>()
public final val size: kotlin.Int = 0
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
}