Dotty Documentation

0.2.0-bin-SNAPSHOT

class SpaceEngine
extends SpaceLogic

Scala implementation of space logic

[-] Constructors

SpaceEngine ( )
SpaceEngine ( implicit ctx: Context )

[-] Members

[+] private implicit val ctx : Context
[+] private val scalaConsType : TypeRef
[+] private val scalaListType : TypeRef
[+] private val scalaNilType : TermRef
[+] private val scalaSeqFactoryClass : ClassSymbol
[+] private val scalaSomeClass : ClassSymbol
[+] def canDecompose ( tp: Type ) : Boolean

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

[+] 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 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]].

[+] 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 other).

[+] def isEqualType ( tp1: Type , tp2: Type ) : Boolean

Is tp1 the same type as tp2?

[+] def isSubType ( tp1: Type , tp2: Type ) : Boolean

Is tp1 a subtype of tp2?

[+] def project ( pat: Tree ) : Space

Return the space that represents the pattern pat

[+] def projectList ( pats: List [ Tree ] ) : Space

Space of the pattern: List(a, b, c: _*)

[+] 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, then return path1.B.

[+] def show ( s: Space ) : String

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] --> X C --> C if current owner is C !!!

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

Parameter types of the case class type tp