KaCompoundArrayAccessCallResolutionAttempt¶
@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
interface KaCompoundArrayAccessCallResolutionAttempt : KaMultiCallResolutionAttempt
Represents an attempt to resolve a compound array access (e.g. a[1] += "foo" or a[0]++).
When all sub-calls succeed, call contains the assembled KaCompoundArrayAccessCall. When any sub-call fails, call is null but individual attempts still contain their resolution results.
See also¶
Properties¶
call¶
abstract override val call: KaCompoundArrayAccessCall?
The assembled KaCompoundArrayAccessCall, or null if any sub-call failed.
See also
calls¶
val KaCallInfo.calls: List<KaCall>
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.
-
KaSimpleCallResolutionSuccess: the resolvedcallas a single-element list. -
KaMultiCallResolutionAttempt: the assembledcallif all sub-calls succeeded, or the combined calls from individualsimpleAttemptsotherwise.
val KaSimpleOrMultiCall.calls: List<KaSimpleCall<*, *>>
The flattened list of KaSimpleCalls.
-
If
thisis an instance ofKaSimpleCall, the list will contain onlythiscall -
If
thisis an instance ofKaMultiCall, the list will containKaMultiCall.calls
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
getterCallAttempt¶
abstract val getterCallAttempt: KaSimpleCallResolutionAttempt
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¶
abstract val operationCallAttempt: KaSimpleCallResolutionAttempt
The resolution attempt for the operation call (e.g. plus, inc).
See also
setterCallAttempt¶
abstract val setterCallAttempt: KaSimpleCallResolutionAttempt
simpleAttempts¶
abstract val simpleAttempts: List<KaSimpleCallResolutionAttempt>
The list of individual resolution attempts for each sub-call.
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.
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
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.
-
KaSimpleCallResolutionSuccess: the resolvedcall. KaMultiCallResolutionAttempt: the assembledcallif all sub-calls succeeded, ornullotherwise.
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.