Reducer
A type map that tries to reduce (part of) the result type of the type lambda tycon
with the given args
(some of which are wildcard arguments represented by type bounds).
Non-wildcard arguments are substituted everywhere as usual. A wildcard argument
>: L <: H
is substituted for a type lambda parameter X
only under certain conditions.
-
If Mode.AllowLambdaWildcardApply is set: The wildcard argument is substituted only if
X
appears in a toplevel application of the formC[..., X, ...]
and there are no other occurrences of X
in the reduced type. In that case
the refinement above is replaced by
C[..., ? >: L <: H, ...]
The allReplaced
field indicates whether all occurrences of type lambda parameters
in the reduced type have been replaced with arguments.
-
If Mode.AllowLambdaWildcardApply is not set: All
X
arguments are replaced by:? >: L <: H
Any other occurrence of X
in tycon
is replaced by U
, if the
occurrence of X
in tycon
is covariant, or nonvariant, or by L
,
if the occurrence is contravariant.
The idea is that the AllowLambdaWildcardApply
mode is used to check whether
a type can be soundly reduced, and to give an error or warning if that
is not the case. By contrast, the default mode, with AllowLambdaWildcardApply
not set, reduces all applications even if this yields a different type, so
its postcondition is that no type parameters of tycon
appear in the
result type. Using this mode, we can guarantee that appliedTo
will never
produce a higher-kinded application with a type lambda as type constructor.
Value members
Concrete methods
Inherited methods
- Inherited from
- TypeMap
Can the prefix of this static reference be omitted if the reference itself can be omitted? Overridden in TypeOps#avoid.
Can the prefix of this static reference be omitted if the reference itself can be omitted? Overridden in TypeOps#avoid.
- Inherited from
- VariantTraversal
Can be overridden. By default, only the prefix is mapped.
Can be overridden. By default, only the prefix is mapped.
- Inherited from
- TypeMap