Skip to content

KtProjectionKind

enum class KtProjectionKind

The kind of variance projection applied to a type argument in a KtTypeProjection.

  • IN — a contravariant projection, written in T.
  • OUT — a covariant projection, written out T.
  • STAR — a star projection, written *.
  • NONE — an invariant type argument with no projection keyword.

Example:

fun copy(from: Array<out Any>, to: Array<in Any>) {}
//                   ^^^                 ^^
//                   OUT                 IN

Entries

IN

IN

A contravariant projection, written in T.

OUT

OUT

A covariant projection, written out T.

STAR

A star projection, written *.

NONE

An invariant type argument with no projection keyword.

Companion functions

valueOf

open fun valueOf(name: String): KtProjectionKind

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Return

the enum constant with the specified name

Throws

java.lang.IllegalArgumentException

if this enum type has no constant with the specified name

values

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.

Return

an array containing the constants of this enum type, in the order they're declared

Properties

token

@get:Nullable
val token: KtSingleValueToken