dotty.tools.dotc.core

TypeComparer

Related Docs: object TypeComparer | package core

class TypeComparer extends DotClass with ConstraintHandling

Provides methods to compare types.

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

Instance Constructors

  1. new TypeComparer(initctx: 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. def AnyClass: ClassSymbol

  5. def AnyType: TypeRef

  6. var GADTused: Boolean

    Indicates whether a previous subtype check used GADT bounds

  7. def NothingClass: ClassSymbol

  8. def NothingType: TypeRef

  9. def NullClass: ClassSymbol

  10. def ObjectClass: ClassSymbol

  11. 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
    Definition Classes
    ConstraintHandling
  12. def addLess(p1: PolyParam, p2: PolyParam): Boolean

    Attributes
    protected
    Definition Classes
    ConstraintHandling
  13. def addLowerBound(param: PolyParam, bound: Type): Boolean

    Attributes
    protected
    Definition Classes
    ConstraintHandling
  14. 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

    Definition Classes
    ConstraintHandling
  15. def addUpperBound(param: PolyParam, bound: Type): Boolean

    Attributes
    protected
    Definition Classes
    ConstraintHandling
  16. var alwaysFluid: Boolean

    Attributes
    protected
    Definition Classes
    ConstraintHandling
  17. final def andType(tp1: Type, tp2: Type, erased: Boolean = ctx.erasedTypes): Type

    Form a normalized conjunction of two types.

    Form a normalized conjunction of two types. Note: For certain types, & is distributed inside the type. This holds for all types which are not value types (e.g. TypeBounds, ClassInfo, ExprType, MethodType, PolyType). Also, when forming an &, instantiated TypeVars are dereferenced and annotations are stripped. Finally, refined types with the same refined name are opportunistically merged.

    Sometimes, the conjunction of two types cannot be formed because the types are in conflict of each other. In particular:

    1. Two different class types are conflicting. 2. A class type conflicts with a type bounds that does not include the class reference. 3. Two method or poly types with different (type) parameters but the same signature are conflicting

    In these cases, a MergeError is thrown.

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

    Definition Classes
    ConstraintHandling
  19. final def asInstanceOf[T0]: T0

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

    The current bounds of type parameter param

    The current bounds of type parameter param

    Definition Classes
    ConstraintHandling
  21. final def canConstrain(param: PolyParam): Boolean

    Can param be constrained with new bounds?

    Can param be constrained with new bounds?

    Definition Classes
    ConstraintHandling
  22. def checkPropagated(msg: ⇒ String)(result: Boolean): Boolean

    Check that constraint is fully propagated.

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

    Definition Classes
    ConstraintHandling
  23. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. def compareHkApply1(tp1: HKApply, tycon1: Type, args1: List[Type], tp2: Type): Boolean

    Subtype test for the hk application tp1 = tycon1[args1].

  25. def compareHkApply2(tp1: Type, tp2: HKApply, tycon2: Type, args2: List[Type]): Boolean

    Subtype test for the hk application tp2 = tycon2[args2].

  26. 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
    Definition Classes
    ConstraintHandling
  27. def copyIn(ctx: Context): TypeComparer

    A new type comparer of the same type as this one, using the given context.

  28. implicit val ctx: Context

    Definition Classes
    TypeComparerConstraintHandling
  29. final def ensureStableSingleton(tp: Type): SingletonType

  30. final def eq(arg0: AnyRef): Boolean

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

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

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

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

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

    Definition Classes
    ConstraintHandling
  34. 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
    Definition Classes
    ConstraintHandling
  35. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  36. final def glb(tps: List[Type]): Type

    The greatest lower bound of a list types

  37. def glb(tp1: Type, tp2: Type): Type

    The greatest lower bound of two types

  38. def hasMatchingMember(name: Name, tp1: Type, tp2: RefinedType): Boolean

    Does type tp1 have a member with name name whose normalized type is a subtype of the normalized type of the refinement tp2? Normalization is as follows: If tp2 contains a skolem to its refinement type, rebase both itself and the member info of tp on a freshly created skolem type.

    Does type tp1 have a member with name name whose normalized type is a subtype of the normalized type of the refinement tp2? Normalization is as follows: If tp2 contains a skolem to its refinement type, rebase both itself and the member info of tp on a freshly created skolem type.

    Attributes
    protected
  39. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  40. 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.

    Definition Classes
    ConstraintHandling
  41. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  42. def isMatchedByProto(proto: ProtoType, tp: Type): Boolean

    Defer constraining type variables when compared against prototypes

  43. def isSameRef(tp1: Type, tp2: Type): Boolean

    Same as isSameType but also can be applied to overloaded TermRefs, where two overloaded refs are the same if they have pairwise equal alternatives

  44. def isSameType(tp1: Type, tp2: Type): Boolean

    Two types are the same if are mutual subtypes of each other

    Two types are the same if are mutual subtypes of each other

    Definition Classes
    TypeComparerConstraintHandling
  45. final def isSameTypeWhenFrozen(tp1: Type, tp2: Type): Boolean

    Definition Classes
    ConstraintHandling
  46. 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
    Definition Classes
    ConstraintHandling
  47. def isSubArgs(args1: List[Type], args2: List[Type], tparams: List[TypeParamInfo]): Boolean

    Subtype test for corresponding arguments in args1, args2 according to variances in type parameters tparams.

  48. def isSubType(tp1: Type, tp2: Type): Boolean

    Attributes
    protected
    Definition Classes
    TypeComparerConstraintHandling
  49. final def isSubTypeWhenFrozen(tp1: Type, tp2: Type): Boolean

    Definition Classes
    ConstraintHandling
  50. final def lub(tps: List[Type]): Type

    The least upper bound of a list of types

  51. def lub(tp1: Type, tp2: Type): Type

    The least upper bound of two types

    The least upper bound of two types

    Note

    We do not admit singleton types in or-types as lubs.

  52. final def matchesType(tp1: Type, tp2: Type, relaxed: Boolean): Boolean

    A function implementing tp1 matches tp2.

  53. def matchingParams(formals1: List[Type], formals2: List[Type], isJava1: Boolean, isJava2: Boolean): Boolean

    Are syms1 and syms2 parameter lists with pairwise equivalent types?

  54. def matchingTypeParams(poly1: PolyType, poly2: PolyType): Boolean

    Do generic types poly1 and poly2 have type parameters that have the same bounds (after renaming one set to the other)?

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

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

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

    Definition Classes
    AnyRef
  58. final def orType(tp1: Type, tp2: Type, erased: Boolean = ctx.erasedTypes): Type

    Form a normalized conjunction of two types.

    Form a normalized conjunction of two types. Note: For certain types, | is distributed inside the type. This holds for all types which are not value types (e.g. TypeBounds, ClassInfo, ExprType, MethodType, PolyType). Also, when forming an |, instantiated TypeVars are dereferenced and annotations are stripped.

    Sometimes, the disjunction of two types cannot be formed because the types are in conflict of each other. (@see andType for an enumeration of these cases). In cases of conflict a MergeError is raised.

    erased

    Apply erasure semantics. If erased is true, instead of creating an OrType, the lub will be computed using TypeCreator#erasedLub.

  59. def recordStatistics(result: Boolean, prevSuccessCount: Int): Unit

    Record statistics about the total number of subtype checks and the number of "successful" subtype checks, i.e.

    Record statistics about the total number of subtype checks and the number of "successful" subtype checks, i.e. checks that form part of a subtype derivation tree that's ultimately successful.

  60. def showGoal(tp1: Type, tp2: Type)(implicit ctx: Context): Unit

    Show subtype goal that led to an assertion failure

  61. val state: TyperState

    Definition Classes
    TypeComparerConstraintHandling
  62. 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
    Definition Classes
    ConstraintHandling
  63. def subtypeCheckInProgress: Boolean

    Is a subtype check in progress? In that case we may not permanently instantiate type variables, because the corresponding constraint might still be retracted and the instantiation should then be reversed.

  64. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  65. def toString(): String

    Definition Classes
    AnyRef → Any
  66. def topLevelSubType(tp1: Type, tp2: Type): Boolean

  67. def traceIndented[T](str: String)(op: ⇒ T): T

    A hook for showing subtype traces.

    A hook for showing subtype traces. Overridden in ExplainingTypeComparer

  68. 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
    Definition Classes
    ConstraintHandling
  69. def unsupported(methodName: String): Nothing

    Throws an UnsupportedOperationException with the given method name.

    Throws an UnsupportedOperationException with the given method name.

    Definition Classes
    DotClass
  70. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ConstraintHandling

Inherited from DotClass

Inherited from AnyRef

Inherited from Any

Ungrouped