Dotty Documentation


class CheckRealizable
extends Object

Compute realizability status.

A type T is realizable iff it is inhabited by non-null values. This ensures that its type members have good bounds (in the sense from DOT papers). A type projection T#L is legal if T is realizable, and can be understood as Scala 2's v.L forSome { val v: T }.

In general, a realizable type can have multiple inhabitants, hence it need not be stable (in the sense of Type.isStable).

[-] Constructors

CheckRealizable ( )
CheckRealizable ( implicit ctx: Context )

[-] Members

[+] private val checkedFields : Set [ Symbol ]

A set of all fields that have already been checked. Used to avoid infinite recursions when analyzing recursive types.

[+] private implicit val ctx : Context
[+] private def boundsRealizability ( tp: Type ) : Realizability

Realizable if tp has good bounds, a HasProblem... instance pointing to a bad bounds member otherwise. "Has good bounds" means:

  • all type members have good bounds (except for opaque helpers)
  • all refinements of the underlying type have good bounds (except for opaque companions)
  • all base types are class types, and if their arguments are wildcards they have good bounds.
  • base types do not appear in multiple instances with different arguments. (depending on the simplification scheme for AndTypes employed, this could also lead to base types with bad bounds).
[+] private def isLateInitialized ( sym: Symbol ) : Boolean

Is symbol's definitition a lazy or erased val? (note we exclude modules here, because their realizability is ensured separately)

[+] private def memberRealizability ( tp: Type ) : Realizability

Realizable if all of tp's non-strict fields have realizable types, a HasProblemField instance pointing to a bad field otherwise.

[+] def realizability ( tp: Type ) : Realizability

The realizability status of given type tp

[+] private def refinedNames ( tp: Type ) : Set [ Name ]