dotty.tools.dotc.core.TypeApplications

Reducer

Related Doc: package TypeApplications

class Reducer 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 refinement of the form

{ type A = X }

and there are no other occurrences of X in the reduced type. In that case the refinement above is replaced by

{ type A >: L <: U }

The allReplaced field indicates whether all occurrences of type lambda parameters in the reduced type have been replaced with arguments.

2. If Mode.AllowLambdaWildcardApply is not set: All refinements of the form

{ type A = X }

are replaced by:

{ type A >: L <: U }

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.

Linear Supertypes
TypeMap, (Type) ⇒ Type, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Reducer
  2. TypeMap
  3. Function1
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Reducer(tycon: PolyType, args: List[Type])(implicit ctx: Context)

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. var allReplaced: Boolean

  5. def andThen(f: (Type) ⇒ Type): TypeMap

    Definition Classes
    TypeMap
  6. def andThen[A](g: (Type) ⇒ A): (Type) ⇒ A

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  7. def apply(t: Type): Type

    Definition Classes
    ReducerTypeMap → Function1
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def canReduceWildcard(p: PolyParam): Boolean

  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def compose[A](g: (A) ⇒ Type): (A) ⇒ Type

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  12. implicit val ctx: Context

    Attributes
    protected
    Definition Classes
    TypeMap
  13. def derivedAndOrType(tp: AndOrType, tp1: Type, tp2: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  14. def derivedAnnotatedType(tp: AnnotatedType, underlying: Type, annot: Annotation): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  15. def derivedAppliedType(tp: HKApply, tycon: Type, args: List[Type]): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  16. def derivedClassInfo(tp: ClassInfo, pre: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  17. def derivedExprType(tp: ExprType, restpe: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  18. def derivedJavaArrayType(tp: JavaArrayType, elemtp: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  19. def derivedMethodType(tp: MethodType, formals: List[Type], restpe: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  20. def derivedPolyType(tp: PolyType, pbounds: List[TypeBounds], restpe: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  21. def derivedRecType(tp: RecType, parent: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  22. def derivedRefinedType(tp: RefinedType, parent: Type, info: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  23. def derivedSelect(tp: NamedType, pre: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  24. def derivedSuperType(tp: SuperType, thistp: Type, supertp: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  25. def derivedTypeAlias(tp: TypeAlias, alias: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  26. def derivedTypeBounds(tp: TypeBounds, lo: Type, hi: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  27. def derivedWildcardType(tp: WildcardType, bounds: Type): Type

    Attributes
    protected
    Definition Classes
    TypeMap
  28. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  30. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  31. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  32. def hasWildcardArg(p: PolyParam): Boolean

  33. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  34. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  35. def mapClassInfo(tp: ClassInfo): Type

    Can be overridden.

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

    Attributes
    protected
    Definition Classes
    TypeMap
  36. def mapOver(tree: ast.tpd.Tree): ast.tpd.Tree

    Definition Classes
    TypeMap
  37. def mapOver(annot: Annotation): Annotation

    Definition Classes
    TypeMap
  38. def mapOver(scope: Scope): Scope

    Definition Classes
    TypeMap
  39. def mapOver(syms: List[Symbol]): List[Symbol]

    Definition Classes
    TypeMap
  40. def mapOver(tp: Type): Type

    Map this function over given type

    Map this function over given type

    Definition Classes
    TypeMap
  41. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  42. final def notify(): Unit

    Definition Classes
    AnyRef
  43. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  44. def stopAtStatic: Boolean

    Attributes
    protected
    Definition Classes
    TypeMap
  45. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  46. def toString(): String

    Definition Classes
    Function1 → AnyRef → Any
  47. var variance: Int

    Attributes
    protected
    Definition Classes
    TypeMap
  48. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from TypeMap

Inherited from (Type) ⇒ Type

Inherited from AnyRef

Inherited from Any

Ungrouped