TypeApplications

final class TypeApplications(val self: Type) extends AnyVal

A decorator that provides methods for modeling type application

Companion
object
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def EtaExpand(tparams: List[TypeParamInfo])(using Context): Type

Convert a type constructor TC which has type parameters X1, ..., Xn to [X1, ..., Xn] -> TC[X1, ..., Xn].

Convert a type constructor TC which has type parameters X1, ..., Xn to [X1, ..., Xn] -> TC[X1, ..., Xn].

def EtaExpandIfHK(bound: Type)(using Context): Type

Eta expand if self is a (non-lambda) class reference and bound is a higher-kinded type

Eta expand if self is a (non-lambda) class reference and bound is a higher-kinded type

final def appliedTo(args: List[Type])(using Context): Type

The type representing

The type representing

T[U1, ..., Un]

where

Value Params
args

= U1,...,Un

self

= T

final def appliedTo(arg: Type)(using Context): Type
final def appliedTo(arg1: Type, arg2: Type)(using Context): Type
final def applyIfParameterized(args: List[Type])(using Context): Type
final def argInfo(using Context): Type

If this is the image of a type argument; recover the type argument, otherwise NoType.

If this is the image of a type argument; recover the type argument, otherwise NoType.

final def argInfos(using Context): List[Type]

If this is an encoding of a (partially) applied type, return its arguments, otherwise return Nil. Existential types in arguments are returned as TypeBounds instances.

If this is an encoding of a (partially) applied type, return its arguments, otherwise return Nil. Existential types in arguments are returned as TypeBounds instances.

def argTypes(using Context): List[Type]

Argument types where existential types in arguments are disallowed

Argument types where existential types in arguments are disallowed

def argTypesHi(using Context): List[Type]

Argument types where existential types in arguments are approximated by their upper bound

Argument types where existential types in arguments are approximated by their upper bound

def argTypesLo(using Context): List[Type]

Argument types where existential types in arguments are approximated by their lower bound

Argument types where existential types in arguments are approximated by their lower bound

def dropAlias(using Context): Type

If this is a type alias, its underlying type, otherwise the type itself

If this is a type alias, its underlying type, otherwise the type itself

def elemType(using Context): Type

The element type of a sequence or array

The element type of a sequence or array

If self is not lambda-bound, eta expand it.

If self is not lambda-bound, eta expand it.

def hasSameKindAs(other: Type)(using Context): Boolean

Do self and other have the same kinds (not counting bounds and variances)? Note: An any-kinded type "has the same kind" as any other type.

Do self and other have the same kinds (not counting bounds and variances)? Note: An any-kinded type "has the same kind" as any other type.

Is self type of kind "*"?

Is self type of kind "*"?

def hkResult(using Context): Type

If self type is higher-kinded, its result type, otherwise NoType. Note: The hkResult of an any-kinded type is again AnyKind.

If self type is higher-kinded, its result type, otherwise NoType. Note: The hkResult of an any-kinded type is again AnyKind.

If self is a higher-kinded type, its type parameters, otherwise Nil

If self is a higher-kinded type, its type parameters, otherwise Nil

Is self type bounded by a type lambda or AnyKind?

Is self type bounded by a type lambda or AnyKind?

final def safeAppliedTo(args: List[Type])(using Context): Type

A cycle-safe version of appliedTo where computing type parameters do not force the typeconstructor. Instead, if the type constructor is completing, we make up hk type parameters matching the arguments. This is needed when unpickling Scala2 files such as scala.collection.generic.Mapfactory.

A cycle-safe version of appliedTo where computing type parameters do not force the typeconstructor. Instead, if the type constructor is completing, we make up hk type parameters matching the arguments. This is needed when unpickling Scala2 files such as scala.collection.generic.Mapfactory.

def safeDealias(using Context): Type

Dealias type if it can be done without forcing the TypeRef's info

Dealias type if it can be done without forcing the TypeRef's info

final def toBounds(using Context): TypeBounds

Turns non-bounds types to type bounds. A (possible lambda abstracted) match type is turned into a match alias. Every other type is turned into a type alias

Turns non-bounds types to type bounds. A (possible lambda abstracted) match type is turned into a match alias. Every other type is turned into a type alias

def translateFromRepeated(toArray: Boolean, translateWildcard: Boolean)(using Context): Type

If this is a repeated parameter *T, translate it to either Seq[T] or Array[? <: T] depending on the value of toArray. Additionally, if translateWildcard is true, a wildcard type will be translated to *<?>. Other types are kept as-is.

If this is a repeated parameter *T, translate it to either Seq[T] or Array[? <: T] depending on the value of toArray. Additionally, if translateWildcard is true, a wildcard type will be translated to *<?>. Other types are kept as-is.

Translate T to T & Object in the situations where an Array[T] coming from Java would need to be interpreted as an Array[T & Object] to be erased correctly.

Translate T to T & Object in the situations where an Array[T] coming from Java would need to be interpreted as an Array[T & Object] to be erased correctly.

Object is the top-level type in Java, but when it appears in a Java signature we replace it by a special FromJavaObject type for convenience, this in turns requires us to special-case generic arrays as described in case 3 in the documentation of FromJavaObjectSymbol. This is necessary because a fully generic Java array erases to an array of Object, whereas a fully generic Scala array erases to Object to allow primitive arrays as subtypes.

Note: According to http://cr.openjdk.java.net/~briangoetz/valhalla/sov/02-object-model.html, it's possible that future JVMs will consider that:

int[] <: Integer[] <: Object[]

So hopefully our grand-children will not have to deal with this non-sense!

def translateParameterized(from: ClassSymbol, to: ClassSymbol, wildcardArg: Boolean)(using Context): Type

Translate a type of the form From[T] to either To[T] or To[? <: T] (if wildcardArg is set). Keep other types as they are. from and to must be static classes, both with one type parameter, and the same variance. Do the same for by name types => From[T] and => To[T]

Translate a type of the form From[T] to either To[T] or To[? <: T] (if wildcardArg is set). Keep other types as they are. from and to must be static classes, both with one type parameter, and the same variance. Do the same for by name types => From[T] and => To[T]

Translate a From[T] into a *T.

Translate a From[T] into a *T.

If self is a generic class, its type parameter symbols, otherwise Nil

If self is a generic class, its type parameter symbols, otherwise Nil

The type parameters of this type are: For a ClassInfo type, the type parameters of its class. For a typeref referring to a class, the type parameters of the class. For a refinement type, the type parameters of its parent, dropping any type parameter that is-rebound by the refinement.

The type parameters of this type are: For a ClassInfo type, the type parameters of its class. For a typeref referring to a class, the type parameters of the class. For a refinement type, the type parameters of its parent, dropping any type parameter that is-rebound by the refinement.

Concrete fields

val self: Type