LevelAvoidMap

dotty.tools.dotc.core.ConstraintHandling.LevelAvoidMap
class LevelAvoidMap(topLevelVariance: Int, maxLevel: Int)(using x$3: Context) extends AvoidMap

An approximating map that prevents types nested deeper than maxLevel as well as WildcardTypes from leaking into the constraint.

Attributes

Graph
Supertypes
class AvoidMap
class TypeMap
trait Type => Type
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

override def apply(tp: Type): Type

Attributes

Definition Classes

Return a (possibly fresh) type variable of a level no greater than maxLevel which is:

Return a (possibly fresh) type variable of a level no greater than maxLevel which is:

  • lower-bounded by tp if variance >= 0
  • upper-bounded by tp if variance <= 0 If this isn't possible, return the empty range.

Attributes

override def mapWild(t: WildcardType): Type

Attributes

Definition Classes

Inherited methods

def andThen(f: Type => Type): TypeMap

Attributes

Inherited from:
TypeMap
def andThen[A](g: Type => A): T1 => A

Attributes

Inherited from:
Function1
inline protected def atVariance[T](v: Int)(op: => T): T

Attributes

Inherited from:
VariantTraversal
def compose[A](g: A => Type): A => R

Attributes

Inherited from:
Function1
override protected def derivedAlias(tp: AliasingBounds, alias: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedAndType(tp: AndType, tp1: Type, tp2: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedAnnotatedType(tp: AnnotatedType, underlying: Type, annot: Annotation): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedAppliedType(tp: AppliedType, tycon: Type, args: List[Type]): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedCapturingType(tp: Type, parent: Type, refs: CaptureSet): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedClassInfo(tp: ClassInfo, pre: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
protected def derivedExprType(tp: ExprType, restpe: Type): Type

Attributes

Inherited from:
TypeMap
protected def derivedJavaArrayType(tp: JavaArrayType, elemtp: Type): Type

Attributes

Inherited from:
TypeMap
override protected def derivedLambdaType(tp: LambdaType)(formals: List[PInfo], restpe: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedMatchType(tp: MatchType, bound: Type, scrutinee: Type, cases: List[Type]): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedOrType(tp: OrType, tp1: Type, tp2: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedRecType(tp: RecType, parent: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedRefinedType(tp: RefinedType, parent: Type, info: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override def derivedSelect(tp: NamedType, pre: Type): Type

Three deviations from standard derivedSelect:

Three deviations from standard derivedSelect:

  1. We first try a widening conversion to the type's info with the original prefix. Since the original prefix is known to be a subtype of the returned prefix, this can improve results.
  2. Then, if the approximation result is a singleton reference C#x.type, we replace by the widened type, which is usually more natural.
  3. Finally, we need to handle the case where the prefix type does not have a member named tp.name anymmore. In that case, we need to fall back to Bot..Top.

Attributes

Definition Classes
Inherited from:
AvoidMap
override protected def derivedSkolemType(tp: SkolemType, info: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedSuperType(tp: SuperType, thistp: Type, supertp: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedTypeBounds(tp: TypeBounds, lo: Type, hi: Type): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
override protected def derivedWildcardType(tp: WildcardType, bounds: Type): WildcardType

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
protected def emptyRange: Type

Attributes

Inherited from:
ApproximatingTypeMap
protected def expandBounds(tp: TypeBounds): Type

Attributes

Inherited from:
ApproximatingTypeMap
def expandParam(tp: NamedType, pre: Type): Type

Expand parameter reference corresponding to prefix pre; If the expansion is a wildcard parameter reference, convert its underlying bounds to a range, otherwise return the expansion.

Expand parameter reference corresponding to prefix pre; If the expansion is a wildcard parameter reference, convert its underlying bounds to a range, otherwise return the expansion.

Attributes

Inherited from:
ApproximatingTypeMap

Whether it is currently expanding bounds

Whether it is currently expanding bounds

It is used to avoid following LazyRef in F-Bounds

Attributes

Inherited from:
ApproximatingTypeMap
def isRange(tp: Type): Boolean

Attributes

Inherited from:
TypeMap
override def isStaticPrefix(pre: Type)(using Context): Boolean

True iff all NamedTypes on this prefix are static

True iff all NamedTypes on this prefix are static

Attributes

Definition Classes
Inherited from:
AvoidMap
protected def lower(tp: Type): Type

Attributes

Inherited from:
ApproximatingTypeMap
protected def mapArgs(args: List[Type], tparams: List[ParamInfo]): List[Type]

Attributes

Inherited from:
TypeMap
override def mapCapturingType(tp: Type, parent: Type, refs: CaptureSet, v: Int): Type

Attributes

Definition Classes
Inherited from:
ApproximatingTypeMap
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.

Attributes

Inherited from:
TypeMap
def mapOver(tree: Tree): Tree

Attributes

Inherited from:
TypeMap
def mapOver(scope: Scope): Scope

Attributes

Inherited from:
TypeMap
def mapOver(syms: List[Symbol]): List[Symbol]

Attributes

Inherited from:
TypeMap
def mapOver(tp: Type): Type

Map this function over given type

Map this function over given type

Attributes

Inherited from:
TypeMap
protected def mapOverLambda(tp: LambdaType): Type

Attributes

Inherited from:
TypeMap

Overridden in TypeOps.avoid

Overridden in TypeOps.avoid

Attributes

Inherited from:
ApproximatingTypeMap
protected def range(lo: Type, hi: Type): Type

Attributes

Inherited from:
ApproximatingTypeMap
protected def rangeToBounds(tp: Type): Type

Attributes

Inherited from:
ApproximatingTypeMap
protected def reapply(tp: Type): Type

Attributes

Inherited from:
ApproximatingTypeMap
protected def stopAt: StopAt

Attributes

Inherited from:
VariantTraversal

Attributes

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.

Attributes

Returns:

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1
def tryWiden(tp: NamedType, pre: Type): Type

Try to widen a named type to its info relative to given prefix pre, where possible. The possible cases are listed inline in the code.

Try to widen a named type to its info relative to given prefix pre, where possible. The possible cases are listed inline in the code.

Attributes

Inherited from:
ApproximatingTypeMap
protected def tyconTypeParams(tp: AppliedType)(using Context): List[ParamInfo]

The type parameters of the constructor of this applied type. Overridden in OrderingConstraint's ConstraintAwareTraversal to take account of instantiations in the constraint that are not yet propagated to the instance types of type variables.

The type parameters of the constructor of this applied type. Overridden in OrderingConstraint's ConstraintAwareTraversal to take account of instantiations in the constraint that are not yet propagated to the instance types of type variables.

Attributes

Inherited from:
VariantTraversal
protected def upper(tp: Type): Type

Attributes

Inherited from:
ApproximatingTypeMap
protected def useAlternate(tp: Type): Type

Use an alterate type tp that replaces a range. This can happen if the prefix of a Select is a range and the selected symbol is an alias type or a value with a singleton type. In both cases we can forget the prefix and use the symbol's type.

Use an alterate type tp that replaces a range. This can happen if the prefix of a Select is a range and the selected symbol is an alias type or a value with a singleton type. In both cases we can forget the prefix and use the symbol's type.

Attributes

Inherited from:
ApproximatingTypeMap

Inherited fields

lazy val localParamRefs: HashSet[Type]

Attributes

Inherited from:
AvoidMap

Implicits

Inherited implicits

implicit protected val mapCtx: Context

Attributes

Inherited from:
TypeMap