QuotesImpl

scala.quoted.runtime.impl.QuotesImpl
See theQuotesImpl companion object
class QuotesImpl extends Quotes with QuoteUnpickler with QuoteMatching

Attributes

Companion:
object
Graph
Supertypes
trait QuoteMatching
trait QuoteUnpickler
trait Quotes
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Classlikes

object ExprMatch extends ExprMatchModule

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
object TypeMatch extends TypeMatchModule

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
object reflect extends reflectModule

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
reflect.type

Inherited classlikes

Attributes

Inherited from:
QuoteMatching
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ExprMatch.type

Attributes

Inherited from:
QuoteMatching
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object TypeMatch.type

Low-level Typed AST metaprogramming API.

Low-level Typed AST metaprogramming API.

Provides all functionality related to AST-based metaprogramming.

Each type XYZ in the API is defined as an abstract type type XYZ. Methods on XYZ are provided by a given XYZMethods which implements extension methods on XYZ in the trait XYZMethods. The XYZ module is defined by a val XYZ: XYZModule which contains the methods defined in XYZModule. Type tests (TypeTest) are also given to perform subtype checks on these types.

Type hierarchy


+- Tree -+- PackageClause
         |
         +- Statement -+- Import
         |             +- Export
         |             +- Definition --+- ClassDef
         |             |               +- TypeDef
         |             |               +- DefDef
         |             |               +- ValDef
         |             |
         |             +- Term --------+- Ref -+- Ident -+- Wildcard
         |                             |       +- Select
         |                             |
         |                             +- Literal
         |                             +- This
         |                             +- New
         |                             +- NamedArg
         |                             +- Apply
         |                             +- TypeApply
         |                             +- Super
         |                             +- Assign
         |                             +- Block
         |                             +- Closure
         |                             +- If
         |                             +- Match
         |                             +- SummonFrom
         |                             +- Try
         |                             +- Return
         |                             +- Repeated
         |                             +- Inlined
         |                             +- SelectOuter
         |                             +- While
         |                             +---+- Typed
         |                                /
         +- TypedOrTest +----------------·
         +- Bind
         +- Unapply
         +- Alternatives
         |
         +- CaseDef
         +- TypeCaseDef
         |
         +- TypeTree ----+- Inferred
         |               +- TypeIdent
         |               +- TypeSelect
         |               +- TypeProjection
         |               +- Singleton
         |               +- Refined
         |               +- Applied
         |               +- Annotated
         |               +- MatchTypeTree
         |               +- ByName
         |               +- LambdaTypeTree
         |               +- TypeBind
         |               +- TypeBlock
         |
         +- TypeBoundsTree
         +- WildcardTypeTree

+- ParamClause -+- TypeParamClause
                +- TermParamClause

+- TypeRepr -+- NamedType -+- TermRef
             |             +- TypeRef
             +- ConstantType
             +- SuperType
             +- Refinement
             +- AppliedType
             +- AnnotatedType
             +- AndOrType -+- AndType
             |             +- OrType
             +- MatchType
             +- ByNameType
             +- ParamRef
             +- ThisType
             +- RecursiveThis
             +- RecursiveType
             +- LambdaType -+- MethodOrPoly -+- MethodType
             |              |                +- PolyType
             |              +- TypeLambda
             +- MatchCase
             +- TypeBounds
             +- NoPrefix

+- Selector -+- SimpleSelector
             +- RenameSelector
             +- OmitSelector
             +- GivenSelector

+- Signature

+- Position

+- SourceFile

+- Constant -+- BooleanConstant
             +- ByteConstant
             +- ShortConstant
             +- IntConstant
             +- LongConstant
             +- FloatConstant
             +- DoubleConstant
             +- CharConstant
             +- StringConstant
             +- UnitConstant
             +- NullConstant
             +- ClassOfConstant
+- Symbol

+- Flags

Attributes

Inherited from:
Quotes
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object reflect.type

Inherited types

type Nested = Quotes

Type of a Quotes provided by a splice within a quote that took this context.

Type of a Quotes provided by a splice within a quote that took this context.

Attributes

Inherited from:
Quotes

Value members

Concrete methods

def unpickleExpr[T](pickled: String | List[String], typeHole: (Int, Seq[Any]) => Type[_ <: AnyKind], termHole: (Int, Seq[Any], Quotes) => Expr[_]): Expr[T]

Unpickle repr which represents a pickled Expr tree, replacing splice nodes with holes

Unpickle repr which represents a pickled Expr tree, replacing splice nodes with holes

Generated for code compiled with Scala 3.0.x and 3.1.x

Attributes

def unpickleExprV2[T](pickled: String | List[String], types: Seq[Type[_ <: AnyKind]], termHole: Null | (Int, Seq[Type[_ <: AnyKind] | Expr[Any]], Quotes) => Expr[_]): Expr[T]

Unpickle repr which represents a pickled Expr tree, replacing splice nodes with holes.

Unpickle repr which represents a pickled Expr tree, replacing splice nodes with holes.

Generated for code compiled with Scala 3.2.0+

Attributes

def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => Type[_ <: AnyKind], termHole: (Int, Seq[Any], Quotes) => Expr[_]): Type[T]

Unpickle repr which represents a pickled Type tree, replacing splice nodes with holes

Unpickle repr which represents a pickled Type tree, replacing splice nodes with holes

Generated for code compiled with Scala 3.0.x and 3.1.x

Attributes

def unpickleTypeV2[T <: AnyKind](pickled: String | List[String], types: Seq[Type[_ <: AnyKind]]): Type[T]

Unpickle repr which represents a pickled Type tree, replacing splice nodes with holes

Unpickle repr which represents a pickled Type tree, replacing splice nodes with holes

Generated for code compiled with Scala 3.2.0+

Attributes

Givens

Givens

given ctx: Context

Extensions

Extensions

extension [T](self: Expr[T])
def matches(that: Expr[Any]): Boolean

Pattern matches this against that. Effectively performing a deep equality check. It does the equivalent of

Pattern matches this against that. Effectively performing a deep equality check. It does the equivalent of

this match
  case '{...} => true // where the contents of the pattern are the contents of `that`
  case _ => false

Attributes

def show: String

Show a source code like representation of this expression

Show a source code like representation of this expression

Attributes

def valueOrAbort(using fromExpr: FromExpr[T]): T

Return the value of this expression.

Return the value of this expression.

Emits an error and aborts if the expression does not represent a value or possibly contains side effects. Otherwise returns the value.

Attributes

extension (self: Expr[Any])
def asExprOf[X](using Type[X]): Expr[X]

Convert this to an quoted.Expr[X] if this expression is a valid expression of type X or throws

Convert this to an quoted.Expr[X] if this expression is a valid expression of type X or throws

Attributes

def isExprOf[X](using Type[X]): Boolean

Checks is the quoted.Expr[?] is valid expression of type X

Checks is the quoted.Expr[?] is valid expression of type X

Attributes

Deprecated and Inherited extensions

extension [T](self: Expr[T])
def value(using FromExpr[T]): Option[T]

Return the value of this expression.

Return the value of this expression.

Returns None if the expression does not represent a value or possibly contains side effects. Otherwise returns the Some of the value.

Attributes

Inherited from:
Quotes
def valueOrError(using FromExpr[T]): T

Return the value of this expression.

Return the value of this expression.

Emits an error and throws if the expression does not represent a value or possibly contains side effects. Otherwise returns the value.

Attributes

Deprecated
true
Inherited from:
Quotes