K2: Fix exception for PropertyDelegateProvider + lazy case

^KT-63646 Fixed
This commit is contained in:
Denis.Zharkov
2023-11-26 14:13:33 +01:00
committed by Space Team
parent 11d203d0a7
commit bb548e3df4
8 changed files with 82 additions and 4 deletions
@@ -0,0 +1,26 @@
// ISSUE: KT-63646
// WITH_STDLIB
interface MyPropertyDelegateProvider<out Y1> {
operator fun provideDelegate(thisRef: Nothing?, property: kotlin.reflect.KProperty<*>): Y1
}
// To look for `getValue` we need to fix Y2 after `provideDelegate` call
fun <Y2> foo(x: () -> Y2): MyPropertyDelegateProvider<Y2> = TODO()
interface MyLazy<X1> {
operator fun getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): X1 = TODO()
}
fun <X3> myLazy(x: () -> X3): MyLazy<X3> = TODO()
val property1 by foo {
myLazy { "1" }
}
val property2 by foo {
lazy { "2" } // Regular lazy has `getValue` as an extension
}
fun main() {
property1.length
property2.length
}
@@ -0,0 +1,26 @@
// ISSUE: KT-63646
// WITH_STDLIB
interface MyPropertyDelegateProvider<out Y1> {
operator fun provideDelegate(thisRef: Nothing?, property: kotlin.reflect.KProperty<*>): Y1
}
// To look for `getValue` we need to fix Y2 after `provideDelegate` call
fun <Y2> foo(x: () -> Y2): MyPropertyDelegateProvider<Y2> = TODO()
interface MyLazy<X1> {
operator fun getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): X1 = TODO()
}
fun <X3> myLazy(x: () -> X3): MyLazy<X3> = TODO()
val property1 by <!DELEGATE_SPECIAL_FUNCTION_MISSING!>foo {
myLazy { "1" }
}<!>
val property2 by foo {
lazy { "2" } // Regular lazy has `getValue` as an extension
}
fun main() {
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>property1<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
property2.length
}