Skip to content

KaCompoundVariableAccessCallResolutionAttempt

Represents an attempt to resolve a compound variable access (e.g. i += 1 or i++).

When all sub-calls succeed, call contains the assembled KaCompoundVariableAccessCall. When any sub-call fails, call is null but individual attempts still contain their resolution results.

See also

Properties

call

abstract override val call: KaCompoundVariableAccessCall?

The assembled KaCompoundVariableAccessCall, or null if any sub-call failed.

See also

calls

The list of KaCalls associated with the KaCallInfo. The list contains a single KaCall in case of a successful call, but may contain multiple candidates in case of an error call.

The flattened list of resolved calls.

The flattened list of KaSimpleCalls.

errors

The list of errors that occurred during the resolution.

The list is empty if and only if the resolution succeeded. So, unlike a this is KaSimpleCallResolutionError check, which only covers simple attempts, this property detects failures of every attempt kind.

See also

The list of errors that occurred during the resolution.

The list is empty if and only if the resolution succeeded. So, unlike a this is KaSimpleSymbolResolutionError check, which only covers simple attempts, this property detects failures of every attempt kind.

See also

isSuccessful

Whether the resolution succeeded.

true if and only if successful is not null, and equivalently if and only if errors is empty.

Unlike a this is KaSimpleCallResolutionSuccess check, which only covers simple attempts, this property also accounts for KaMultiCallResolutionAttempt, which fails as soon as any of its sub-calls fails.

See also

Whether the resolution succeeded.

true if and only if errors is empty. A KaCompoundSymbolResolutionError is always a failure, even when some of its sub-attempts succeeded.

See also

operationCallAttempt

The resolution attempt for the operation call (e.g. plus, inc).

See also

simpleAttempts

The list of individual resolution attempts for each sub-call.

simpleAttempts

The flattened list of simple resolution attempts.

The list is never empty.

The flattened list of simple resolution attempts.

The list is never empty.

single

The only call of calls, or null if the attempt has no calls or more than one.

Unlike successful, a call is also returned for a failed resolution, as long as calls holds exactly one. For a failed KaMultiCallResolutionAttempt that entry may come from any sub-attempt — a resolved sub-call, or a candidate of a failed one — so it is not necessarily a candidate for the element itself.

For a successful KaMultiCallResolutionAttempt, calls holds the assembled KaMultiCall, so single is that multi-call and its simple/function/variable narrowings are all null.

Example

class Foo {
   private fun bar() {}
}

fun usage(foo: Foo) {
   foo.bar()
//     ^^^^^
}

bar() is resolved to a KaSimpleCallResolutionError, so successful is null, while single is the bar candidate call.

See also

successful

The resolved call if the resolution succeeded, or null if it failed.

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

variableCallAttempt

The resolution attempt for the variable access.

See also

Functions

assertIsValidAndAccessible

fold

inline fun <T> KaCallResolutionAttempt.fold(onSuccess: (KaSimpleOrMultiCall) -> T, onFailure: (List<KaSimpleCallResolutionError>) -> T): T

Folds over a KaCallResolutionAttempt depending on whether the resolution succeeded.

inline fun <T> KaSymbolResolutionAttempt.fold(onSuccess: (List<KaSymbol>) -> T, onFailure: (List<KaSimpleSymbolResolutionError>) -> T): T

Folds over a KaSymbolResolutionAttempt depending on whether the resolution succeeded.

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.