KaCompoundSymbolResolutionError¶
@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
interface KaCompoundSymbolResolutionError : KaSymbolResolutionAttempt
Represents a failed resolution of a compound (multi) call at the symbol level.
This type is produced only when a compound call has a mix of successful and failed sub-calls, or when all sub-calls fail. The simpleAttempts list contains:
-
At most one
KaSimpleSymbolResolutionSuccess(merging symbols from all successful sub-calls) -
At least one
KaSimpleSymbolResolutionError -
At least two entries in total
When all sub-calls succeed, KaSimpleSymbolResolutionSuccess is returned instead. When a simple call fails, KaSimpleSymbolResolutionError is returned instead.
Unlike KaMultiCallResolutionAttempt, this type does not distinguish between specific compound call kinds (for-loop, delegated property, etc.) — it simply holds a flat list of sub-call resolution attempts.
See also¶
Properties¶
errors¶
The list of errors that occurred during the resolution.
-
KaSimpleCallResolutionSuccess: an empty list. -
KaSimpleCallResolutionError:thiserror as a single-element list. -
KaMultiCallResolutionAttempt: the errors among the individualsub-attempts. A multi-call attempt fails as soon as any of its sub-calls fails, so the list is empty if and only if the assembledcallis notnull.
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.
-
KaSimpleSymbolResolutionSuccess: an empty list. -
KaSimpleSymbolResolutionError:thiserror as a single-element list. -
KaCompoundSymbolResolutionError: the errors among the individualsub-attempts, which always contain at least one.
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¶
abstract val simpleAttempts: List<KaSimpleSymbolResolutionAttempt>
The list of individual resolution attempts for each sub-call.
Contains at most one KaSimpleSymbolResolutionSuccess and at least one KaSimpleSymbolResolutionError. At least two entries in total.
simpleAttempts¶
The flattened list of simple resolution attempts.
-
KaSimpleCallResolutionAttempt:thisattempt as a single-element list. -
KaMultiCallResolutionAttempt: the individualsub-attempts.
The list is never empty.
The flattened list of simple resolution attempts.
-
KaSimpleSymbolResolutionAttempt:thisattempt as a single-element list. -
KaCompoundSymbolResolutionError: the individualsub-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.
-
If
thisis an instance ofKaSimpleCall, the list will contain only theKaSimpleCall.signature's symbol -
If
thisis an instance ofKaMultiCall, the list will contain symbols from allKaMultiCall.calls
A list of KaSymbol.
-
If
thisis an instance ofKaSimpleSymbolResolutionSuccess, the list will containKaSimpleSymbolResolutionSuccess.symbols. -
If
thisis an instance ofKaSimpleSymbolResolutionError, the list will containKaSimpleSymbolResolutionError.candidateSymbols. -
If
thisis an instance ofKaCompoundSymbolResolutionError, the list will contain the combined symbols from all attempts.
See also
token¶
abstract val token: KaLifetimeToken
The KaLifetimeToken which determines the lifetime of the lifetime owner.
Functions¶
assertIsValidAndAccessible¶
inline fun KaLifetimeOwner.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.
-
KaSimpleCallResolutionSuccess: invokesonSuccesswith the resolvedcall. -
KaSimpleCallResolutionError: invokesonFailurewith the error wrapped in a single-element list. -
KaMultiCallResolutionAttempt: if all sub-calls succeeded, invokesonSuccesswith the assembledcall; otherwise invokesonFailurewith theerrorsof the failed sub-calls. The successful sub-calls are not passed toonFailure; usesimpleAttemptsto reach them.
inline fun <T> KaSymbolResolutionAttempt.fold(onSuccess: (List<KaSymbol>) -> T, onFailure: (List<KaSimpleSymbolResolutionError>) -> T): T
Folds over a KaSymbolResolutionAttempt depending on whether the resolution succeeded.
-
KaSimpleSymbolResolutionSuccess: invokesonSuccesswith the resolvedsymbols. -
KaSimpleSymbolResolutionError: invokesonFailurewith the error wrapped in a single-element list. -
KaCompoundSymbolResolutionError: invokesonFailurewith theerrorsof the failed sub-calls. The successful sub-call, if any, is not passed toonFailure; usesimpleAttemptsto reach it.
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.
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.