Support isInitialized intrinsic for lateinit properties
See https://github.com/Kotlin/KEEP/pull/73 #KT-9327 Fixed
This commit is contained in:
@@ -64,4 +64,13 @@ internal annotation class InlineOnly
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class DynamicExtension
|
||||
internal annotation class DynamicExtension
|
||||
|
||||
/**
|
||||
* The value of this parameter should be a property reference expression (`this::foo`), referencing a `lateinit` property,
|
||||
* the backing field of which is accessible at the point where the corresponding argument is passed.
|
||||
*/
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@SinceKotlin("1.2")
|
||||
internal annotation class AccessibleLateinitPropertyLiteral
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
@file:kotlin.jvm.JvmName("LateinitKt")
|
||||
@file:kotlin.jvm.JvmVersion
|
||||
@file:Suppress("unused")
|
||||
|
||||
package kotlin
|
||||
|
||||
import kotlin.internal.InlineOnly
|
||||
import kotlin.internal.AccessibleLateinitPropertyLiteral
|
||||
import kotlin.reflect.KProperty0
|
||||
|
||||
/**
|
||||
* Returns `true` if this lateinit property has been assigned a value, and `false` otherwise.
|
||||
*
|
||||
* Cannot be used in an inline function, to avoid binary compatibility issues.
|
||||
*/
|
||||
@SinceKotlin("1.2")
|
||||
@InlineOnly
|
||||
inline val @receiver:AccessibleLateinitPropertyLiteral KProperty0<*>.isInitialized: Boolean
|
||||
get() = throw NotImplementedError("Implementation is intrinsic")
|
||||
Reference in New Issue
Block a user