[FIR] Create this reference for getValue calls in delegates with proper type

^KT-57288 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-03-17 14:01:31 +02:00
committed by Space Team
parent 823c60a7dc
commit 16872f7a74
11 changed files with 85 additions and 19 deletions
@@ -0,0 +1,33 @@
FILE: callOnThisInDelegateExpression.kt
public abstract interface Delegate<R, T> : R|kotlin/properties/ReadWriteProperty<R, T>| {
public abstract infix fun resource(factory: R|Factory<R, T>|): R|Delegate<R, T>|
}
public abstract interface Factory<Source, Target> : R|kotlin/Any| {
}
public abstract interface Some : R|kotlin/Any| {
}
public final fun <Self : R|Some|, Target : R|Some|> R|Self|.delegateOf(clazz: R|java/lang/Class<Target>|): R|Delegate<Self, Target?>| {
^delegateOf Null(null)!!
}
public abstract class SomeImpl<R : R|Some|> : R|Some| {
public constructor<R : R|Some|>(): R|SomeImpl<R>| {
super<R|kotlin/Any|>()
}
public abstract val type: R|java/lang/Class<R>|
public get(): R|java/lang/Class<R>|
public final var bundle: R|R?|by this@R|/SomeImpl|.R|/delegateOf|<R|SomeImpl<R>|, R|R|>(this@R|/SomeImpl|.R|/SomeImpl.type|).R|SubstitutionOverride</Delegate.resource: R|Delegate<SomeImpl<R>, R?>|>|(this@R|/SomeImpl|.R|/SomeImpl.getFactory|<R|SomeImpl<R>|, R|R|>())
public get(): R|R?| {
^ this@R|/SomeImpl|.D|/SomeImpl.bundle|.R|SubstitutionOverride</Delegate.getValue: R|R?|>|(this@R|/SomeImpl|, ::R|/SomeImpl.bundle|)
}
public set(<set-?>: R|R?|): R|kotlin/Unit| {
this@R|/SomeImpl|.D|/SomeImpl.bundle|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/SomeImpl|, ::R|/SomeImpl.bundle|, R|<local>/bundle|)
}
public final fun <M : R|SomeImpl<T>|, T : R|Some|> getFactory(): R|Factory<M, T?>| {
^getFactory Null(null)!!
}
}
@@ -0,0 +1,21 @@
// WITH_STDLIB
// ISSUE: KT-57288
import kotlin.properties.ReadWriteProperty
interface Delegate<R, T> : ReadWriteProperty<R, T> {
infix fun resource(factory: Factory<R, T>): Delegate<R, T>
}
interface Factory<Source, Target>
interface Some
fun <Self : Some, Target : Some> Self.delegateOf(clazz: Class<Target>): Delegate<Self, Target?> = null!!
abstract class SomeImpl<R : Some> : Some {
abstract val type: Class<R>
var bundle by delegateOf(type) resource getFactory()
fun <M : SomeImpl<T>, T : Some> getFactory(): Factory<M, T?> = null!!
}