KaVariableSignature¶
@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
interface KaVariableSignature<out S : KaVariableSymbol> : KaCallableSignature<S>
A callable signature of a variable symbol.
Properties¶
callableId¶
open val callableId: CallableId?
The CallableId of the signature, corresponding to the symbol's callable ID.
contextParameters¶
The use-site-substituted context parameters.
name¶
abstract val name: Name
The name of the variable with respect to a ParameterName annotation. It can be different from KaVariableSymbol.name.
Some variables can have their names changed by special annotations like @ParameterName(name = "newName"). This is used to preserve the names of the lambda parameters in situations like this:
// compiled library
fun foo(): (bar: String) -> Unit { ... }
// source code
fun test() {
val action = foo()
action("") // this call
}
Unfortunately, the symbol for the action("") call will be pointing to Function1<P1, R>.invoke(p1: P1): R, because we intentionally unwrap use-site substitution overrides. Because of this, symbol.name will yield "p1", and not "bar".
To overcome this problem, name allows to get the intended name of the parameter, with respect to the @ParameterName annotation.
receiverType¶
abstract val receiverType: KaType?
The use-site-substituted extension receiver type.
returnType¶
abstract val returnType: KaType
The use-site-substituted return type.
symbol¶
The underlying symbol which the signature carries use-site information about.
token¶
abstract val token: KaLifetimeToken
The KaLifetimeToken which determines the lifetime of the lifetime owner.
Functions¶
assertIsValidAndAccessible¶
inline fun KaLifetimeOwner.assertIsValidAndAccessible()
equals¶
hashCode¶
isValid¶
fun KaLifetimeOwner.isValid(): Boolean
Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.
substitute¶
abstract override fun substitute(substitutor: KaSubstitutor): KaVariableSignature<S>
Applies the given substitutor to the signature, returning a new signature with substituted types.
See also
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.