Skip to content

KaTypeCreatorProvider

@SubclassOptInRequired(markerClass = [KaSessionComponentImplementationDetail::class])
interface KaTypeCreatorProvider : KaSessionComponent

Provides an instance of KaTypeCreator to create various types.

Inheritors

Properties

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

typeCreator

abstract val typeCreator: KaTypeCreator

A single entry point for the type building infrastructure.

Functions

assertIsValidAndAccessible

copy

abstract fun <T : KaClassType> T.copy(init: KaClassTypeBuilder.() -> Unit): KaClassType

Creates a copy of this KaClassType with modifications applied via the init block.

The builder is pre-populated with the properties of the original type. The init block can then selectively override these properties.

Example:

val nullableListOfString = listOfStringType.copy {
    isMarkedNullable = true
}

See also

Creates a copy of this KaUsualClassType with modifications applied via the init block.

The builder is pre-populated with the properties of the original type. The init block can then selectively override these properties.

Example:

val nullableListOfString = listOfStringType.copy {
    isMarkedNullable = true
}

See also

Creates a copy of this KaFunctionType with modifications applied via the init block.

The builder is pre-populated with the properties of the original type. The init block can then selectively override these properties.

Example:

val suspendVersion = functionType.copy {
    isSuspend = true
}

See also

Creates a copy of this KaTypeParameterType with modifications applied via the init block.

The builder is pre-populated with the properties of the original type. The init block can then selectively override these properties.

Example:

val nullableT = typeParameterType.copy {
    isMarkedNullable = true
}

See also

isValid

Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.

withValidityAssertion

inline fun <R> KaLifetimeOwner.withValidityAssertion(action: () -> R): R

Executes action only if the KaLifetimeOwner is still valid and accessible. Otherwise, throws a validity exception based on the concrete violation.