Skip to content

KaSimpleSymbolResolutionError

Represents an error that occurred during the resolution of a KtResolvable

A KaCompoundSymbolResolutionError is not an instance of this type, so a type check against this type is not a complete failure check — use errors or isSuccessful instead.

Example

class Foo {
   private fun bar() {}
}

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

bar() will be resolved to KaSimpleSymbolResolutionError with INVISIBLE_REFERENCE diagnostic and the bar symbol candidate

Properties

candidateSymbols

abstract val candidateSymbols: List<KaSymbol>

Represents a collection of candidate symbols for a resolution attempt.

Code example:

class MyClass(private val property: Int)

fun check(m: MyClass) {
    m.property
}

here m.property is resolved into KaSimpleSymbolResolutionError because it is invisible from the call site, but the compiler produces INVISIBLE_REFERENCE diagnostic with property candidate

Note: the collection can be empty

diagnostic

abstract val diagnostic: KaDiagnostic

Defines a reason why this attempt is unsuccessful

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

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.

successfulSymbols

The resolved symbols if the resolution succeeded, or an empty list if it failed.

A successful resolution always has at least one symbol, so an empty list always means a failure.

See also

symbols

The flattened list of KaSymbols for the resolved calls.

A list of KaSymbol.

See also

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

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.