SpaceEngine

dotty.tools.dotc.transform.patmat.SpaceEngine
See theSpaceEngine companion object
class SpaceEngine(using x$1: Context) extends SpaceLogic

Scala implementation of space logic

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

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

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

Attributes

def checkRedundancy(_match: Match): Unit
def covers(unapp: TermRef, scrutineeTp: Type, argLen: Int): Boolean

Whether the extractor covers the given type

Whether the extractor covers the given type

Attributes

def decompose(tp: Type): List[Typ]

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

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

Attributes

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

Return a space containing the values of both types.

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

Attributes

Definition Classes
def isPrimToBox(tp: Type, pt: Type): Boolean

True if we can assume that the two unapply methods are the same. That is, given the same parameter, they return the same result.

True if we can assume that the two unapply methods are the same. That is, given the same parameter, they return the same result.

We assume that unapply methods are pure, but the same method may be called with different prefixes, thus behaving differently.

Attributes

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

Is tp1 a subtype of tp2?

Is tp1 a subtype of tp2?

Attributes

override def isSubspace(a: Space, b: Space)(using Context): Boolean

Is a a subspace of b? Equivalent to a - b == Empty, but faster

Is a a subspace of b? Equivalent to a - b == Empty, but faster

Attributes

Definition Classes
def project(pat: Tree): Space

Return the space that represents the pattern pat

Return the space that represents the pattern pat

Attributes

def projectSeq(pats: List[Tree]): Space

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

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

Attributes

Whether the counterexample is satisfiable. The space is flattened and non-empty.

Whether the counterexample is satisfiable. The space is flattened and non-empty.

Attributes

def show(ss: Seq[Space]): String
def show(s: Space): String

Display spaces

Display spaces

Attributes

def showType(tp: Type, showTypeArgs: Boolean): String

Show friendly type name with current scope in mind

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 !!!

Attributes

def signature(unapp: TermRef, scrutineeTp: Type, argLen: Int): List[Type]

Parameter types of the case class type tp. Adapted from unapplyPlan in patternMatcher

Parameter types of the case class type tp. Adapted from unapplyPlan in patternMatcher

Attributes

Return the underlying type of non-module, non-constant, non-enum case singleton types. Also widen ExprType to its result type, and rewrap any annotation wrappers. For example, with val opt = None, widen opt.type to None.type.

Return the underlying type of non-module, non-constant, non-enum case singleton types. Also widen ExprType to its result type, and rewrap any annotation wrappers. For example, with val opt = None, widen opt.type to None.type.

Attributes

Inherited methods

def dedup(spaces: Seq[Space])(using Context): Seq[Space]

Remove a space if it's a subspace of remaining spaces

Remove a space if it's a subspace of remaining spaces

Note: dedup will return the same result if the sequence >= 10

Attributes

Inherited from:
SpaceLogic
def flatten(space: Space)(using Context): Seq[Space]

Flatten space to get rid of Or for pretty print

Flatten space to get rid of Or for pretty print

Attributes

Inherited from:
SpaceLogic
def intersect(a: Space, b: Space)(using Context): Space

Intersection of two spaces

Intersection of two spaces

Attributes

Inherited from:
SpaceLogic
def minus(a: Space, b: Space)(using Context): Space

The space of a not covered by b

The space of a not covered by b

Attributes

Inherited from:
SpaceLogic
def simplify(space: Space)(using Context): Space

Simplify space such that a space equal to Empty becomes Empty

Simplify space such that a space equal to Empty becomes Empty

Attributes

Inherited from:
SpaceLogic