Reducer

class Reducer(tycon: TypeLambda, args: List[Type])(using x$3: Context) extends TypeMap

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.

  1. If Mode.AllowLambdaWildcardApply is set: The wildcard argument is substituted only if X appears in a toplevel application of the form

    C[..., 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.

  1. 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.

class TypeMap
trait Type => Type
class Object
trait Matchable
class Any

Value members

Inherited methods

def andThen(f: Type => Type): TypeMap
Inherited from:
TypeMap
def andThen[A](g: Type => A): Type => A
Inherited from:
Function1
inline protected def atVariance[T](v: Int)(op: => T): T
Inherited from:
VariantTraversal
def compose[A](g: A => Type): A => Type
Inherited from:
Function1
protected def derivedAlias(tp: AliasingBounds, alias: Type): Type
Inherited from:
TypeMap
protected def derivedAndType(tp: AndType, tp1: Type, tp2: Type): Type
Inherited from:
TypeMap
protected def derivedAnnotatedType(tp: AnnotatedType, underlying: Type, annot: Annotation): Type
Inherited from:
TypeMap
protected def derivedAppliedType(tp: AppliedType, tycon: Type, args: List[Type]): Type
Inherited from:
TypeMap
protected def derivedClassInfo(tp: ClassInfo, pre: Type): Type
Inherited from:
TypeMap
protected def derivedExprType(tp: ExprType, restpe: Type): Type
Inherited from:
TypeMap
protected def derivedJavaArrayType(tp: JavaArrayType, elemtp: Type): Type
Inherited from:
TypeMap
protected def derivedLambdaType(tp: LambdaType)(formals: List[PInfo], restpe: Type): Type
Inherited from:
TypeMap
protected def derivedMatchType(tp: MatchType, bound: Type, scrutinee: Type, cases: List[Type]): Type
Inherited from:
TypeMap
protected def derivedOrType(tp: OrType, tp1: Type, tp2: Type): Type
Inherited from:
TypeMap
protected def derivedRecType(tp: RecType, parent: Type): Type
Inherited from:
TypeMap
protected def derivedRefinedType(tp: RefinedType, parent: Type, info: Type): Type
Inherited from:
TypeMap
protected def derivedSelect(tp: NamedType, pre: Type): Type
Inherited from:
TypeMap
protected def derivedSkolemType(tp: SkolemType, info: Type): Type
Inherited from:
TypeMap
protected def derivedSuperType(tp: SuperType, thistp: Type, supertp: Type): Type
Inherited from:
TypeMap
protected def derivedTypeBounds(tp: TypeBounds, lo: Type, hi: Type): Type
Inherited from:
TypeMap
protected def derivedWildcardType(tp: WildcardType, bounds: Type): Type
Inherited from:
TypeMap
def isRange(tp: Type): Boolean
Inherited from:
TypeMap
protected def isStaticPrefix(pre: Type)(using Context): Boolean

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
protected def mapArgs(args: List[Type], tparams: List[ParamInfo]): List[Type]
Inherited from:
TypeMap
protected def mapClassInfo(tp: ClassInfo): Type

Can be overridden. By default, only the prefix is mapped.

Can be overridden. By default, only the prefix is mapped.

Inherited from:
TypeMap
def mapOver(tree: Tree): Tree
Inherited from:
TypeMap
def mapOver(scope: Scope): Scope
Inherited from:
TypeMap
def mapOver(syms: List[Symbol]): List[Symbol]
Inherited from:
TypeMap
def mapOver(tp: Type): Type

Map this function over given type

Map this function over given type

Inherited from:
TypeMap
protected def mapOverLambda(tp: LambdaType): Type
Inherited from:
TypeMap
protected def stopAt: StopAt
Inherited from:
VariantTraversal
Inherited from:
VariantTraversal
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Returns:

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1

Concrete fields

Implicits

Inherited implicits

implicit protected val mapCtx: Context
Inherited from:
TypeMap