A decorator that provides methods for modeling type application
Constructors
Members
Convert a type constructor TC
which has type parameters T1, ..., Tn
in a context where type parameters U1,...,Un
are expected to
LambdaXYZ { Apply = TCh...
Convert a type constructor TC
which has type parameters T1, ..., Tn
in a context where type parameters U1,...,Un
are expected to
LambdaXYZ { Apply = TC[hk$0, ..., hk$n] }
Here, XYZ corresponds to the variances of
- U1,...,Un
if the variances of T1,...,Tn
are pairwise compatible with U1,...,Un
,
- T1,...,Tn
otherwise.
v1 is compatible with v2, if v1 = v2 or v2 is non-variant.
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
Lambda abstract self
with given type parameters. Examples:
type T[X] = U becomes type T = [X] -> U
type T[X] >: L <: U becomes type T >: L <: ([X] -> U)
TODO: Handle parameterized lower bounds
Lambda abstract self
with given type parameters. Examples:
type T[X] = U becomes type T = [X] -> U
type T[X] >: L <: U becomes type T >: L <: ([X] -> U)
TODO: Handle parameterized lower bounds
If argument A and type parameter P are higher-kinded, adapt the variances of A to those of P, ensuring that the variances of the type lambda A agree wit...
[X] [List]
[X][X]
[+X][X]
GenericCompanion[[X] -> ListBuffer[X]] <: GenericCompanion[[+X] -> GenTraversable[X]]
[X][X]
If argument A and type parameter P are higher-kinded, adapt the variances of A to those of P, ensuring that the variances of the type lambda A agree with the variances of corresponding higher-kinded type parameters of P. Example:
class GenericCompanion[+CC[X]] GenericCompanion[List]
with adaptHkVariances, the argument List
will expand to
[X] => List[X]
instead of
[+X] => List[X]
even though List
is covariant. This adaptation is necessary to ignore conflicting
variances in overriding members that have types of hk-type parameters such as
GenericCompanion[GenTraversable]
or GenericCompanion[ListBuffer]
.
When checking overriding, we need to validate the subtype relationship
GenericCompanion[[X] -> ListBuffer[X]] <: GenericCompanion[[+X] -> GenTraversable[X]]
Without adaptation, this would be false, and hence an overriding error would result. But with adaptation, the rhs argument will be adapted to
[X] -> GenTraversable[X]
which makes the subtype test succeed. The crucial point here is that, since GenericCompanion only expects a non-variant CC, the fact that GenTraversable is covariant is irrelevant, so can be ignored.
The type representing
T[U1, ..., Un]
where
The type representing
T[U1, ..., Un]
where
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.
If this is an encoding of a (partially) applied type, return its arguments, otherwise return Nil. Existential types in arguments are returned as TypeBou...
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.
Argument types where existential types in arguments are disallowed
Argument types where existential types in arguments are disallowed
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
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
The type arguments of this type's base type instance wrt. base
.
Existential types in arguments are returned as TypeBounds instances.
The type arguments of this type's base type instance wrt. base
.
Existential types in arguments are returned as TypeBounds instances.
The type arguments of this type's base type instance wrt.base
.
Existential types in arguments are disallowed.
The type arguments of this type's base type instance wrt.base
.
Existential types in arguments are disallowed.
The type arguments of this type's base type instance wrt.base
.
Existential types in arguments are approximated by their upper bound.
The type arguments of this type's base type instance wrt.base
.
Existential types in arguments are approximated by their upper bound.
The type arguments of this type's base type instance wrt.base
.
Existential types in arguments are approximated by their lower bound.
The type arguments of this type's base type instance wrt.base
.
Existential types in arguments are approximated by their lower bound.
The base type including all type arguments and applicable refinements of this type. Refinements are applicable if they refine a member of the parent typ...
The base type including all type arguments and applicable refinements of this type. Refinements are applicable if they refine a member of the parent type which furthermore is not a name-mangled type parameter. Existential types in arguments are returned as TypeBounds instances.
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
The element type of a sequence or array
The element type of a sequence or array
If self is not higher-kinded, eta expand it.
If self is not higher-kinded, eta expand it.
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 higher-kinded (i.e. of kind != "*")?
Is self type higher-kinded (i.e. of kind != "*")?
The named type parameters declared or inherited by this type. These are all uninstantiated named type parameters of this type or one of its base types.
The named type parameters declared or inherited by this type. These are all uninstantiated named type parameters of this type or one of its base types.
A cycle-safe version of appliedTo
where computing type parameters do not force
the typeconstructor. Instead, if the type constructor is completing, we...
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
.
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
Turn this type, which is used as an argument for
type parameter tparam
, into a TypeBounds RHS
Turn this type, which is used as an argument for
type parameter tparam
, into a TypeBounds RHS
Translate a type of the form From[T] to To[T], keep other types as they are.
from
and to
must be static classes, both with one type parameter, and the same...
[T][T]
Translate a type of the form From[T] to To[T], 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]
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 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 typeref referring to a Lambda class, the type parameters of
its right hand side or upper bound.
For a refinement type, the type parameters of its parent, dropping
any type parameter that is-rebound by the refinement. "Re-bind" means:
The refinement contains a TypeAlias for the type parameter, or
it introduces bounds for the type parameter, and we are not in the
special case of a type Lambda, where a LambdaTrait gets refined
with the bounds on its hk args. See LambdaAbstract
, where these
types get introduced, and see isBoundedLambda
below for the test.
If this is repeated parameter type, its underlying Seq type, or, if isJava is true, Array type, else the type itself.
If this is repeated parameter type, its underlying Seq type, or, if isJava is true, Array type, else the type itself.
The smallest supertype of this type that instantiated none of the named type parameters
in params
. That is, for each named type parameter p
in params
,...
The smallest supertype of this type that instantiated none of the named type parameters
in params
. That is, for each named type parameter p
in params
, either there is
no type field named p
in this type, or p
is a named type parameter of this type.
The first case is important for the recursive case of AndTypes, because some of their operands might
be missing the named parameter altogether, but the AndType as a whole can still
contain it.
The core type without any type arguments.
The core type without any type arguments.