Use canonical class identity for delegate checks

This commit is contained in:
sergeych committed 2026-03-27 19:19:38 +03:00
1 parent 7c059b4741
commit 4269310beb
4 files changed
+40 -7

No files matched your search

+1 -2
View File
@@ -421,7 +421,6 @@ fun with<T,R>(self: T, block: T.()->R): R {
Can only be used with 'val' properties.
*/
class lazy<T,ThisRefType=Object>(creatorParam: ThisRefType.()->T) : Delegate<T,ThisRefType> {
private val creator: ThisRefType.()->T = creatorParam
private var value = Unset
override fun bind(name: String, access: DelegateAccess, thisRef: ThisRefType): Object {
@@ -431,7 +430,7 @@ class lazy<T,ThisRefType=Object>(creatorParam: ThisRefType.()->T) : Delegate<T,T
override fun getValue(thisRef: ThisRefType, name: String): T {
if (value == Unset)
value = with(thisRef, creator)
value = with(thisRef, creatorParam)
value as T
}
}