QuotePatterns
dotty.tools.dotc.quoted.QuotePatterns
object QuotePatterns
Attributes
- Graph
-
- Supertypes
- Self type
-
QuotePatterns.type
Members list
Value members
Concrete methods
Check for restricted patterns
Check for restricted patterns
Attributes
Decodes an encoded pattern into a QuotePattern.
Decodes an encoded pattern into a QuotePattern.
See the documentation of encode
, this does the opposite transformation.
Attributes
Encode the quote pattern into an unapply
that the pattern matcher can handle.
Encode the quote pattern into an unapply
that the pattern matcher can handle.
A quote pattern
'{
// type variables (QuotePattern.bindings Bind list)
type t1 >: l1 <: b1
...
type tn >: ln <: bn
// pattern (QuotePattern.body)
... $x1: T1 ... ${ F(x2) }: T2 ... $f(a1: A1, ..., an: An): T3 ...
} // (using quotes) (QuotePattern.quotes)
is transformed into the pattern
quotes
.asInstanceOf[QuoteMatching] // scala.quoted.runtime.QuoteMatching
.ExprMatch // or TypeMatch
.unapply[
KCons[t1 >: l1 <: b1, ...KCons[tn >: ln <: bn, KNil]...], // scala.quoted.runtime.{KCons, KNil}
(T1, T2, (A1, ..., An) => T3, ...)
](
'{
type t1' >: l1' <: b1'
...
type tn' >: ln' <: bn'
// scala.quoted.runtime.Patterns.{patternHole, higherOrderHole}
... $patternHole[T1] ... $patternHole[T2] ... $higherOrderHole[T3](a1, ..., an) ...
},
quotes
)
Here ti' is a `TypeDef` that represents `ti` in the (pickled) pattern body. The type bounds
`>: l1' <: b1` of `ti'` are the same as the type bounds `>: l1 <: b1` replacing all references
to `tj` with `tj'`.
Attributes
In this article