KaTypeScope¶
@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
interface KaTypeScope : KaScopeLike
A scope which contains members whose use-site type parameters have been substituted with the type arguments of a concrete KaType. Callable declarations with substituted type parameters are represented as KaCallableSignature.
See also¶
Properties¶
declarationScope¶
context(session: KaSession)
val KaTypeScope.declarationScope: KaScope
token¶
abstract val token: KaLifetimeToken
The KaLifetimeToken which determines the lifetime of the lifetime owner.
Functions¶
assertIsValidAndAccessible¶
inline fun KaLifetimeOwner.assertIsValidAndAccessible()
getAllPossibleNames¶
open fun getAllPossibleNames(): Set<Name>
Returns the set of top-level declaration names contained in the scope. The set may contain false positives, i.e. names which aren't contained in the scope.
getCallableSignatures¶
abstract fun getCallableSignatures(nameFilter: (Name) -> Boolean = { true }): Sequence<KaCallableSignature<*>>
Returns a sequence of KaCallableSignatures contained in the scope which match the nameFilter.
The implementation of this function needs to retrieve a set of all possible names before processing callables. The overload with Collection<Name> should be used when the candidate name set is known.
abstract fun getCallableSignatures(names: Collection<Name>): Sequence<KaCallableSignature<*>>
open fun getCallableSignatures(vararg names: Name): Sequence<KaCallableSignature<*>>
Returns a sequence of KaCallableSignatures contained in the scope which match the given names.
The implementation of this function is optimized compared to using a name filter and should be used when the candidate name set is known.
getClassifierSymbols¶
abstract fun getClassifierSymbols(nameFilter: (Name) -> Boolean = { true }): Sequence<KaClassifierSymbol>
Returns a sequence of KaClassifierSymbols contained in the scope which match the nameFilter.
The result includes:
-
Nested classes
-
Inner classes
-
Nested type aliases for a class scope
-
Top-level classes and top-level type aliases for a file scope
The implementation of this function needs to retrieve a set of all possible names before processing classifiers. The overload with Collection<Name> should be used when the candidate name set is known.
abstract fun getClassifierSymbols(names: Collection<Name>): Sequence<KaClassifierSymbol>
open fun getClassifierSymbols(vararg names: Name): Sequence<KaClassifierSymbol>
Returns a sequence of KaClassifierSymbols contained in the scope which match the given names.
The result includes:
-
Nested classes
-
Inner classes
-
Nested type aliases for a class scope
-
Top-level classes and top-level type aliases for a file scope
The implementation of this function is optimized compared to using a name filter and should be used when the candidate name set is known.
getConstructors¶
abstract fun getConstructors(): Sequence<KaConstructorSymbol>
Returns a sequence of KaConstructorSymbols contained in the scope.
getPossibleCallableNames¶
abstract fun getPossibleCallableNames(): Set<Name>
Returns the set of top-level callable names contained in the scope. The set may contain false positives, i.e. names which aren't contained in the scope.
getPossibleClassifierNames¶
abstract fun getPossibleClassifierNames(): Set<Name>
Returns the set of top-level classifier names contained in the scope. The set may contain false positives, i.e. names which aren't contained in the scope.
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.
mayContainName¶
open fun mayContainName(name: Name): Boolean
Checks whether the scope might contain the given name.
Since getPossibleCallableNames and getPossibleClassifierNames admit false positives, the result may be true even if the scope doesn't contain a declaration with such a name. The reverse is not so: when mayContainName is false, the scope definitely doesn't contain a declaration with that name.
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.