Import quick fix: support provideDelegate

#KT-28049 Fixed
This commit is contained in:
Dmitry Gridin
2019-09-24 16:23:46 +07:00
parent 79199260b9
commit 1ee827bfc8
3 changed files with 59 additions and 15 deletions
@@ -0,0 +1,50 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Type 'A' has no method 'getValue(MyUI, KProperty<*>)' and thus it cannot serve as a delegate
package bs
import some.A
class MyUI {
fun <T> bindResource(id: Int): A = A()
val image by <caret>bindResource<Int>(42)
}
// FILE: second.kt
package some
import bs.MyUI
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
class A
operator fun A.provideDelegate(
thisRef: MyUI,
prop: KProperty<*>
): ReadOnlyProperty<MyUI, A> = TODO()
// FILE: first.after.kt
// "Import" "true"
// ERROR: Type 'A' has no method 'getValue(MyUI, KProperty<*>)' and thus it cannot serve as a delegate
package bs
import some.A
import some.provideDelegate
class MyUI {
fun <T> bindResource(id: Int): A = A()
val image by <caret>bindResource<Int>(42)
}