Skip to content

scope

context(session: KaSession)
val KaType.scope: KaTypeScope?

A KaTypeScope for the given KaType, or null if the type is erroneous. The scope includes all members which are callable on a given type. It also includes synthetic Java properties.

Comparing to KaScope, the KaTypeScope contains members whose use-site type parameters have been substituted.

Example

fun foo(list: List<String>) {
    list
}

We can get a KaTypeScope for the expression type of list. This scope contains a get(index: Int): String function, where the return type E from List.get is substituted with the type argument String.

See also