scala.tools.nsc.typechecker.PatternMatching

MatchTranslation

trait MatchTranslation extends MatchMonadInterface

Self Type
MatchTranslation with TreeMakers with CodegenCore
Source
PatternMatching.scala
Linear Supertypes
Known Subclasses
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MatchTranslation
  2. MatchMonadInterface
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. abstract class ExtractorCall extends AnyRef

  2. class ExtractorCallProd extends (MatchTranslation.this)#ExtractorCall

  3. class ExtractorCallRegular extends (MatchTranslation.this)#ExtractorCall

Abstract Value Members

  1. abstract def inMatchMonad(tp: Global.Type): Global.Type

    Definition Classes
    MatchMonadInterface
  2. abstract def matchMonadSym: Global.Symbol

    Attributes
    protected
    Definition Classes
    MatchMonadInterface
  3. abstract def pureType(tp: Global.Type): Global.Type

    Definition Classes
    MatchMonadInterface
  4. abstract val typer: (analyzer)#Typer

    Definition Classes
    MatchMonadInterface

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (MatchTranslation, B)

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to ArrowAssoc[MatchTranslation] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. object Bound

  9. object ExtractorCall

  10. object WildcardPattern

    A conservative approximation of which patterns do not discern anything.

  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def checkMatchVariablePatterns(m: Global.Match): Unit

  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. def ensuring(cond: (MatchTranslation) ⇒ Boolean, msg: ⇒ Any): MatchTranslation

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to Ensuring[MatchTranslation] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: (MatchTranslation) ⇒ Boolean): MatchTranslation

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to Ensuring[MatchTranslation] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean, msg: ⇒ Any): MatchTranslation

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to Ensuring[MatchTranslation] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: Boolean): MatchTranslation

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to Ensuring[MatchTranslation] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  20. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  21. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. final def matchMonadResult(tp: Global.Type): Global.Type

    Definition Classes
    MatchMonadInterface
  26. val matchOwner: Global.Symbol

    Definition Classes
    MatchMonadInterface
  27. def matchingSymbolInScope(pat: Global.Tree): Global.Symbol

  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  31. def reportMissingCases(pos: Global.Position, counterExamples: List[String]): Unit

    Definition Classes
    MatchMonadInterface
  32. def reportUnreachable(pos: Global.Position): Unit

    Definition Classes
    MatchMonadInterface
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  34. def toString(): String

    Definition Classes
    AnyRef → Any
  35. def translateBody(body: Global.Tree, matchPt: Global.Type): (MatchTranslation.this)#TreeMaker

  36. def translateCase(scrutSym: Global.Symbol, pt: Global.Type)(caseDef: Global.CaseDef): collection.immutable.List[(MatchTranslation.this)#TreeMaker]

    The translation of pat if guard => body has two aspects: 1) the substitution due to the variables bound by patterns 2) the combination of the extractor calls using flatMap.

    The translation of pat if guard => body has two aspects: 1) the substitution due to the variables bound by patterns 2) the combination of the extractor calls using flatMap.

    2) is easy -- it looks like: translatePattern_1.flatMap(translatePattern_2....flatMap(translatePattern_N.flatMap(translateGuard.flatMap((x_i) => success(Xbody(x_i)))))...) this must be right-leaning tree, as can be seen intuitively by considering the scope of bound variables: variables bound by pat_1 must be visible from the function inside the left-most flatMap right up to Xbody all the way on the right 1) is tricky because translatePattern_i determines the shape of translatePattern_i+1: zoom in on translatePattern_1.flatMap(translatePattern_2) for example -- it actually looks more like: translatePattern_1(x_scrut).flatMap((x_1) => {y_i -> x_1._i}translatePattern_2)

    x_1 references the result (inside the monad) of the extractor corresponding to pat_1, this result holds the values for the constructor arguments, which translatePattern_1 has extracted from the object pointed to by x_scrut. The y_i are the symbols bound by pat_1 (in order) in the scope of the remainder of the pattern, and they must thus be replaced by:

    • (for 1-ary unapply) x_1
    • (for n-ary unapply, n > 1) selection of the i'th tuple component of x_1
    • (for unapplySeq) x_1.apply(i)

    in the treemakers,

    Thus, the result type of translatePattern_i's extractor must conform to M[(T_1,..., T_n)].

    Operationally, phase 1) is a foldLeft, since we must consider the depth-first-flattening of the transformed patterns from left to right. For every pattern ast node, it produces a transformed ast and a function that will take care of binding and substitution of the next ast (to the right).

  37. def translateGuard(guard: Global.Tree): List[(MatchTranslation.this)#TreeMaker]

  38. def translateMatch(match_: Global.Match): Global.Tree

    Implement a pattern match by turning its cases (including the implicit failure case) into the corresponding (monadic) extractors, and combining them with the orElse combinator.

    Implement a pattern match by turning its cases (including the implicit failure case) into the corresponding (monadic) extractors, and combining them with the orElse combinator.

    For scrutinee match { case1 ... caseN }, the resulting tree has the shape runOrElse(scrutinee)(x => translateCase1(x).orElse(translateCase2(x)).....orElse(zero))

    NOTE: the resulting tree is not type checked, nor are nested pattern matches transformed thus, you must typecheck the result (and that will in turn translate nested matches) this could probably optimized... (but note that the matchStrategy must be solved for each nested patternmatch)

  39. def translatePattern(patBinder: Global.Symbol, patTree: Global.Tree): List[(MatchTranslation.this)#TreeMaker]

  40. def translateTry(caseDefs: List[Global.CaseDef], pt: Global.Type, pos: Global.Position): List[Global.CaseDef]

  41. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  42. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  43. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  44. def [B](y: B): (MatchTranslation, B)

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to ArrowAssoc[MatchTranslation] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implict Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (matchTranslation: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (matchTranslation: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: MatchTranslation

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to ArrowAssoc[MatchTranslation] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (matchTranslation: ArrowAssoc[MatchTranslation]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: MatchTranslation

    Implicit information
    This member is added by an implicit conversion from MatchTranslation to Ensuring[MatchTranslation] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (matchTranslation: Ensuring[MatchTranslation]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from MatchMonadInterface

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from MatchTranslation to StringAdd

Inherited by implicit conversion any2stringfmt from MatchTranslation to StringFormat

Inherited by implicit conversion any2ArrowAssoc from MatchTranslation to ArrowAssoc[MatchTranslation]

Inherited by implicit conversion any2Ensuring from MatchTranslation to Ensuring[MatchTranslation]

Ungrouped