Quoted expression of typeT.
Quoted expression of typeT.
Expr has extension methods that are defined inscala.quoted.Quotes.
A type class for types that can convert aquoted.Expr[T] to aT.
A type class for types that can convert aquoted.Expr[T] to aT.
'{1} ->1,'{2} ->2, ...StringSome,List,Either, ...)new X orX.apply can be lifted into its valueQuotation context provided by a macro expansion or in the scope ofscala.quoted.staging.run. Used to perform all operations on quotedExpr orType.
Quotation context provided by a macro expansion or in the scope ofscala.quoted.staging.run. Used to perform all operations on quotedExpr orType.
It contains the low-level Typed AST API metaprogramming API. This API does not have the static type guarantees thatExpr andType provide.Quotes are generated from an enclosing${ ... } orscala.staging.run. For example:
import scala.quoted.*inline def myMacro: Expr[T] = ${ /* (quotes: Quotes) ?=> */ myExpr }def myExpr(using Quotes): Expr[T] = '{ f(${ /* (quotes: Quotes) ?=> */ myOtherExpr }) }}def myOtherExpr(using Quotes): Expr[U] = '{ ... }A type class for types that can convert a value ofT intoquoted.Expr[T] an expression that will create a copy of the value.
A type class for types that can convert a value ofT intoquoted.Expr[T] an expression that will create a copy of the value.
Type (or type constructor)T needed contextually when usingT in a quoted expression'{... T ...}
Type (or type constructor)T needed contextually when usingT in a quoted expression'{... T ...}
Expression representation of literal sequence of expressions.
Expression representation of literal sequence of expressions.
Varargs can be used to create the an expressionargs that will be used as varargs'{ f($args: _*) } or it can be used to extract all the arguments of the a varargs.
Current Quotes in scope
Current Quotes in scope
Usage:
import scala.quoted.*def myExpr[T](using Quotes): Expr[T] = { import quotes.reflect.* ???}