class SpaceEngine
extends SpaceLogic

Scala implementation of space logic

Constructors

SpaceEngine ( )
SpaceEngine ( implicit ctx: Context )

Members

private implicit val ctx : Context
def canDecompose ( tp: Type ) : Boolean

Abstract sealed types, or-types, Boolean and Java enums can be decomposed

Abstract sealed types, or-types, Boolean and Java enums can be decomposed

def checkExhaustivity ( _match: Match ) : Unit
def checkRedundancy ( _match: Match ) : Unit
def checkable ( tree: Match ) : Boolean
def decompose ( tp: Type ) : List [ Space ]

Decompose a type into subspaces -- assume the type can be decomposed

Decompose a type into subspaces -- assume the type can be decomposed

def erase ( tp: Type ) : Type
[+] def expose ( tp: Type ) : Type

Expose refined type to eliminate reference to type variables

A = B M { type T = A } ~~> M { type T = B }

A <: X :> Y...

Expose refined type to eliminate reference to type variables

A = B M { type T = A } ~~> M { type T = B }

A <: X :> Y M { type T = A } ~~> M { type T <: X :> Y }

A <: X :> Y B <: U :> V M { type T <: A :> B } ~~> M { type T <: X :> V }

A = X B = Y M { type T <: A :> B } ~~> M { type T <: X :> Y }

private def implementability ( tp: Type ) : Implementability

Checks if it's possible to create a trait/class which is a subtype of tp.

  • doesn't handle member collisions (will not declare a type unimplementable because of one)
  • expects that neither Any nor Object reach it (this is currently true due to both isSubType and and/or type simplification)

See [[intersectUnrelatedAtomicTypes]].

Checks if it's possible to create a trait/class which is a subtype of tp.

  • doesn't handle member collisions (will not declare a type unimplementable because of one)
  • expects that neither Any nor Object reach it (this is currently true due to both isSubType and and/or type simplification)

See [[intersectUnrelatedAtomicTypes]].

override def intersectUnrelatedAtomicTypes ( tp1: Type , tp2: Type ) : Space

Return a space containing the values of both types.

The types should be atomic (non-decomposable) and unrelated (neither should be a subtype of the othe...

Return a space containing the values of both types.

The types should be atomic (non-decomposable) and unrelated (neither should be a subtype of the other).

def isEqualType ( tp1: Type , tp2: Type ) : Boolean

Is tp1 the same type as tp2?

Is tp1 the same type as tp2?

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

Is tp1 a subtype of tp2?

Is tp1 a subtype of tp2?

def project ( pat: Tree , roundUp: Boolean ) ( implicit ctx: Context ) : Space

Return the space that represents the pattern pat

If roundUp is true, approximate extractors to its type, otherwise approximate extractors to Empty

Return the space that represents the pattern pat

If roundUp is true, approximate extractors to its type, otherwise approximate extractors to Empty

def project$default$2 : Boolean

Return the space that represents the pattern pat

If roundUp is true, approximate extractors to its type, otherwise approximate extractors to Empty

Return the space that represents the pattern pat

If roundUp is true, approximate extractors to its type, otherwise approximate extractors to Empty

[+] def refine ( tp1: Type , tp2: Type ) : Type

Refine tp2 based on tp1

E.g. if tp1 is Option[Int], tp2 is Some, then return Some[Int].

If tp1 is path1.A, tp2 is path2.B, and path1 is subtype of path2,...

Refine tp2 based on tp1

E.g. if tp1 is Option[Int], tp2 is Some, then return Some[Int].

If tp1 is path1.A, tp2 is path2.B, and path1 is subtype of path2, then return path1.B.

def show ( s: Space ) : String

Display spaces

Display spaces

[+] def showType ( tp: Type ) : String

Show friendly type name with current scope in mind

E.g. C.this.B --> B if current owner is C C.this.x.T --> x.T if current owner is C X[T]

Show friendly type name with current scope in mind

E.g. C.this.B --> B if current owner is C C.this.x.T --> x.T if current owner is C X[T] --> X C --> C if current owner is C !!!

def signature ( tp: Type ) : List [ Type ]

Parameter types of the case class type tp

Parameter types of the case class type tp