SpaceEngine

dotty.tools.dotc.transform.patmat.SpaceEngine
object SpaceEngine

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object Parts

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Parts.type
final class PartsExtractor(val get: List[Type]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def canDecompose(typ: Typ)(using Context): Boolean
def checkMatch(m: Match)(using Context): Unit

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

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

Attributes

def computeSimplify(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

def covers(unapp: TermRef, scrutineeTp: Type, argLen: Int)(using Context): Boolean

Whether the extractor covers the given type

Whether the extractor covers the given type

Attributes

def decompose(typ: Typ)(using Context): List[Typ]
def decompose(tp: Type)(using Context): List[Type]

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

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

Attributes

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

def display(s: Space)(using Context): String

Display spaces. Used for printing uncovered spaces in the in-exhaustive error message.

Display spaces. Used for printing uncovered spaces in the in-exhaustive error message.

Attributes

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

def intersect(a: Space, b: Space)(using Context): Space

Intersection of two spaces

Intersection of two spaces

Attributes

def intersectUnrelatedAtomicTypes(tp1: Type, tp2: Type)(sp: Typ | Prod)(using Context): 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

def isIrrefutable(unapp: TermRef, argLen: Int)(using Context): Boolean

Is the unapply or unapplySeq irrefutable?

Is the unapply or unapplySeq irrefutable?

Value parameters

unapp

The unapply function reference

Attributes

def isIrrefutable(unapp: Tree, argLen: Int)(using Context): Boolean

Is the unapply or unapplySeq irrefutable?

Is the unapply or unapplySeq irrefutable?

Value parameters

unapp

The unapply function tree

Attributes

def isIrrefutableQuotedPattern(unapp: Tree, implicits: List[Tree], pt: Type)(using Context): Boolean

Is this an '{..} or '[..] irrefutable quoted patterns?

Is this an '{..} or '[..] irrefutable quoted patterns?

Value parameters

implicits

The implicits of the unapply

pt

The scrutinee type

unapp

The unapply function tree

Attributes

def isPrimToBox(tp: Type, pt: Type)(using Context): Boolean
def isSameUnapply(tp1: TermRef, tp2: TermRef)(using Context): 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)(using Context): Boolean

Is tp1 a subtype of tp2?

Is tp1 a subtype of tp2?

Attributes

def isSubspace(a: Space, b: Space)(using Context): Boolean
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

def project(pat: Tree)(using Context): Space

Return the space that represents the pattern pat

Return the space that represents the pattern pat

Attributes

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

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

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

Attributes

def satisfiable(sp: Space)(using Context): Boolean

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 signature(unapp: TermRef, scrutineeTp: Type, argLen: Int)(using Context): List[Type]

Return term parameter types of the extractor unapp. Parameter types of the case class type tp. Adapted from unapplyPlan in patternMatcher

Return term parameter types of the extractor unapp. Parameter types of the case class type tp. Adapted from unapplyPlan in patternMatcher

Attributes

def simplify(space: Space)(using Context): Space
def toUnderlying(tp: Type)(using Context): 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.

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

Concrete fields

val ListOfNoType: List[NoType.type]

Extensions

Extensions

extension (tp: Type)