dotty.tools.dotc.core

ConstraintHandling

Related Doc: package core

trait ConstraintHandling extends AnyRef

Methods for adding constraints and solving them.

What goes into a Constraint as opposed to a ConstrainHandler?

Constraint code is purely functional: Operations get constraints and produce new ones. Constraint code does not have access to a type-comparer. Anything regarding lubs and glbs has to be done elsewhere.

By comparison: Constraint handlers are parts of type comparers and can use their functionality. Constraint handlers update the current constraint as a side effect.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ConstraintHandling
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. implicit abstract val ctx: Context

  2. abstract def isSameType(tp1: Type, tp2: Type): Boolean

    Attributes
    protected
  3. abstract def isSubType(tp1: Type, tp2: Type): Boolean

    Attributes
    protected
  4. abstract val state: TyperState

Concrete 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. def addConstraint(param: PolyParam, bound: Type, fromBelow: Boolean): Boolean

    Add constraint param <: bound if fromBelow is false, param >: bound otherwise.

    Add constraint param <: bound if fromBelow is false, param >: bound otherwise. bound is assumed to be in normalized form, as specified in firstTry and secondTry of TypeComparer. In particular, it should not be an alias type, lazy ref, typevar, wildcard type, error type. In addition, upper bounds may not be AndTypes and lower bounds may not be OrTypes. This is assured by the way isSubType is organized.

    Attributes
    protected
  5. def addLess(p1: PolyParam, p2: PolyParam): Boolean

    Attributes
    protected
  6. def addLowerBound(param: PolyParam, bound: Type): Boolean

    Attributes
    protected
  7. def addToConstraint(pt: PolyType, tvars: List[TypeVar]): Unit

    Add polytype pt, possibly with type variables tvars, to current constraint and propagate all bounds.

    Add polytype pt, possibly with type variables tvars, to current constraint and propagate all bounds.

    tvars

    See Constraint#add

  8. def addUpperBound(param: PolyParam, bound: Type): Boolean

    Attributes
    protected
  9. var alwaysFluid: Boolean

    Attributes
    protected
  10. final def approximation(param: PolyParam, fromBelow: Boolean): Type

    Solve constraint set for given type parameter param.

    Solve constraint set for given type parameter param. If fromBelow is true the parameter is approximated by its lower bound, otherwise it is approximated by its upper bound. However, any occurrences of the parameter in a refinement somewhere in the bound are removed. Also wildcard types in bounds are approximated by their upper or lower bounds. (Such occurrences can arise for F-bounded types). The constraint is left unchanged.

    returns

    the instantiating type

  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. final def bounds(param: PolyParam): TypeBounds

    The current bounds of type parameter param

  13. final def canConstrain(param: PolyParam): Boolean

    Can param be constrained with new bounds?

  14. def checkPropagated(msg: ⇒ String)(result: Boolean): Boolean

    Check that constraint is fully propagated.

    Check that constraint is fully propagated. See comment in Config.checkConstraintsPropagated

  15. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. var comparedPolyTypes: Set[PolyType]

    We are currently comparing polytypes.

    We are currently comparing polytypes. Used as a flag for optimization: when false, no need to do an expensive pruneLambdaParams

    Attributes
    protected
  17. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def fluidly[T](op: ⇒ T): T

    Perform op in a mode where all attempts to set frozen to true are ignored

  21. var frozenConstraint: Boolean

    If the constraint is frozen we cannot add new bounds to the constraint.

    If the constraint is frozen we cannot add new bounds to the constraint.

    Attributes
    protected
  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. def instanceType(param: PolyParam, fromBelow: Boolean): Type

    The instance type of param in the current constraint (which contains param).

    The instance type of param in the current constraint (which contains param). If fromBelow is true, the instance type is the lub of the parameter's lower bounds; otherwise it is the glb of its upper bounds. However, a lower bound instantiation can be a singleton type only if the upper bound is also a singleton type.

  25. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  26. final def isSameTypeWhenFrozen(tp1: Type, tp2: Type): Boolean

  27. final def isSatisfiable: Boolean

    Test whether the lower bounds of all parameters in this constraint are a solution to the constraint.

    Test whether the lower bounds of all parameters in this constraint are a solution to the constraint.

    Attributes
    protected
  28. final def isSubTypeWhenFrozen(tp1: Type, tp2: Type): Boolean

  29. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  32. final def subsumes(c1: Constraint, c2: Constraint, pre: Constraint): Boolean

    Constraint c1 subsumes constraint c2, if under c2 as constraint we have for all poly params p defined in c2 as p >: L2 <: U2:

    Constraint c1 subsumes constraint c2, if under c2 as constraint we have for all poly params p defined in c2 as p >: L2 <: U2:

    c1 defines p with bounds p >: L1 <: U1, and L2 <: L1, and U1 <: U2

    Both c1 and c2 are required to derive from constraint pre, possibly narrowing it with further bounds.

    Attributes
    protected
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  34. def toString(): String

    Definition Classes
    AnyRef → Any
  35. def tryInstantiate(param: PolyParam, tp: Type): Boolean

    Instantiate param to tp if the constraint stays satisfiable

    Instantiate param to tp if the constraint stays satisfiable

    Attributes
    protected
  36. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped