A decorator that provides methods for modeling type application
Convert a type constructor
TC which has type parameters
X1, ..., Xn
[X1, ..., Xn] -> TC[X1, ..., Xn].
Eta expand if
self is a (non-lambda) class reference and
bound is a higher-kinded type
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]
[+X] => List[X]
List is covariant. This adaptation is necessary to ignore conflicting
variances in overriding members that have types of hk-type parameters such as
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]
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 TypeBounds instances.
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 lower bound
If this is a type alias, its underlying type, otherwise the type itself
The element type of a sequence or array
If self is not higher-kinded, eta expand it.
Do self and other have the same kinds (not counting bounds and variances)
If self type is higher-kinded, its result type, otherwise NoType
self is a higher-kinded type, its type parameters, otherwise Nil
Is self type higher-kinded (i.e. of kind != "*")?
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
Dealias type if it can be done without forcing the TypeRef's info
Turns non-bounds types to type aliases
Translate a type of the form From[T] to To[T], keep other types as they are.
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]
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 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.
If this is repeated parameter type, its underlying Seq type, or, if isJava is true, Array type, else the type itself.