Skip to content

KaFunctionTypeFamily

The type has been moved to a new package. Use <strong>org.jetbrains.kotlin.analysis.api.types.KaFunctionTypeFamily</strong> instead.

Describes a family of numbered function types such as Function0, Function1, ..., FunctionN.

Kotlin has the following built-in function type families:

  • Function — regular function types, e.g., (Int) -> String

  • SuspendFunction — suspend function types, e.g., suspend () -> Unit

  • KFunction — reflection types for regular functions

  • KSuspendFunction — reflection types for suspend functions

Compiler plugins may introduce additional custom function type families.

See also

Properties

isInlinable

abstract override val isInlinable: Boolean

Whether function types in this family can be inlined by the compiler.

For built-in families, Function and SuspendFunction are inlinable, while KFunction and KSuspendFunction are not.

isReflect

abstract override val isReflect: Boolean

Whether this family represents reflection function types (KFunction, KSuspendFunction).

isSuspend

abstract override val isSuspend: Boolean

Whether this family represents suspend function types (SuspendFunction, KSuspendFunction).

markerAnnotationClassId

abstract val markerAnnotationClassId: ClassId?

The ClassId of the annotation which marks a function type as belonging to this family, such as androidx.compose.runtime.Composable.

maxArity

abstract override val maxArity: Int

The maximum number of parameters supported by function types in this family.

nameBase

abstract override val nameBase: String

The class name prefix shared by all types in this family.

For example, "Function" for the Function family, "SuspendFunction" for the SuspendFunction family.

supportsConversionFromSimpleFunctionType

Whether function references with a simple function type (e.g., Function0, KFunction0) can be converted to this family.

typeRenderingPrefix

abstract val typeRenderingPrefix: String?

The prefix which precedes a function type of this family when the type is rendered, such as "suspend" for the SuspendFunction family, or "@Composable" for the ComposableFunction family provided by the Compose compiler plugin.

Functions

classId

abstract override fun classId(arity: Int): ClassId

Returns the ClassId of the function type interface for the given arity.

For example, classId(2) on the Function family returns the ClassId for kotlin.Function2.