[NI] Resolve receiver of provideDelegate independently

#KT-38259 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-04-28 03:28:08 +03:00
parent 59f027e3e9
commit 2cee82a348
25 changed files with 211 additions and 53 deletions
@@ -9,6 +9,6 @@ object CommonCase {
operator fun <D, E, R> Fas<D, E, R>.provideDelegate(host: D, p: Any?): Fas<D, E, R> = TODO()
operator fun <D, E, R> Fas<D, E, R>.getValue(receiver: E, p: Any?): R = TODO()
val Long.test1: String by <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>() // common test, not working because of Inference1
val Long.test1: String by <!NI;DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>()<!> // common test, not working because of Inference1
val Long.test2: String by delegate<CommonCase, Long, String>() // should work
}
@@ -9,6 +9,6 @@ object Inference2 {
operator fun <T> Foo<T>.provideDelegate(host: T, p: Any?): Foo<T> = TODO()
operator fun <T> Foo<T>.getValue(receiver: Inference2, p: Any?): String = TODO()
val test1: String by <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>() // same story like in Inference1
val test1: String by <!NI;DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>()<!> // same story like in Inference1
val test2: String by delegate<Inference2>()
}
@@ -0,0 +1,11 @@
// FIR_IDENTICAL
val test: String by materializeDelegate()
fun <T> materializeDelegate(): Delegate<T> = Delegate()
operator fun <K> K.provideDelegate(receiver: Any?, property: kotlin.reflect.KProperty<*>): K = this
class Delegate<V> {
operator fun getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): V = TODO()
}
@@ -0,0 +1,13 @@
package
public val test: kotlin.String
public fun </*0*/ T> materializeDelegate(): Delegate<T>
public operator fun </*0*/ K> K.provideDelegate(/*0*/ receiver: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): K
public final class Delegate</*0*/ V> {
public constructor Delegate</*0*/ V>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): V
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}