Skip to content

KaSubstitutorBuilder

The type has been moved to a new package. Use <strong>org.jetbrains.kotlin.analysis.api.types.KaSubstitutorBuilder</strong> instead.

A DSL builder for KaSubstitutor. Instances are created internally by buildSubstitutor.

See also

Constructors

KaSubstitutorBuilder

constructor(token: KaLifetimeToken)

Properties

mappings

open override val mappings: Map<KaTypeParameterSymbol, KaType>

A map of the type substitutions that have so far been accumulated by the builder.

token

open override val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

Functions

assertIsValidAndAccessible

isValid

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

substitution

open override fun substitution(typeParameter: KaTypeParameterSymbol, type: KaType)

Adds a new typeParameter ->type substitution to the substitutor.

If there already was a substitution with a typeParameter, the function replaces the corresponding substitution with a new one.

substitutions

open override fun substitutions(substitutions: Map<KaTypeParameterSymbol, KaType>)

Adds new KaTypeParameterSymbol ->KaType substitutions to the substitutor.

If there already was a substitution with a KaTypeParameterSymbol, the function replaces the corresponding substitution with a new one.

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.