scala.quoted

package scala.quoted

Members list

Packages

Type members

Classlikes

abstract class Expr[+T]

Quoted expression of type T.

Quoted expression of type T.

Expr has extension methods that are defined in scala.quoted.Quotes.

Attributes

Companion
object
Source
Expr.scala
Supertypes
class Object
trait Matchable
class Any
object Expr

Constructors for expressions

Constructors for expressions

Attributes

Companion
class
Source
Expr.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Expr.type
trait ExprMap

Attributes

Source
ExprMap.scala
Supertypes
class Object
trait Matchable
class Any
object Exprs

Attributes

Source
Exprs.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Exprs.type
trait FromExpr[T]

A type class for types that can convert a quoted.Expr[T] to a T.

A type class for types that can convert a quoted.Expr[T] to a T.

  • Converts expression containing literal values to their values:
    • '{1} -> 1, '{2} -> 2, ...
    • For all primitive types and String
  • Converts an expression that constructs a copy of its value.
    • This expression must be some kind of data structure (Some, List, Either, ...)
    • Calls to new X or X.apply can be lifted into its value
    • Arguments of constructors can be recursively unlifted

Attributes

Companion
object
Source
FromExpr.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object EmptyTupleFromExpr.type
object NilFromExpr.type
object NoneFromExpr.type
object StringContextFromExpr.type
object FromExpr

Default given instances of FromExpr

Default given instances of FromExpr

Attributes

Companion
trait
Source
FromExpr.scala
Supertypes
class Object
trait Matchable
class Any
Self type
FromExpr.type
trait Quotes

Quotation context provided by a macro expansion or in the scope of scala.quoted.staging.run. Used to perform all operations on quoted Expr or Type.

Quotation context provided by a macro expansion or in the scope of scala.quoted.staging.run. Used to perform all operations on quoted Expr or Type.

It contains the low-level Typed AST API metaprogramming API. This API does not have the static type guarantees that Expr and Type provide.

Attributes

Source
Quotes.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait ToExpr[T]

A type class for types that can convert a value of T into quoted.Expr[T] an expression that will create a copy of the value.

A type class for types that can convert a value of T into quoted.Expr[T] an expression that will create a copy of the value.

Attributes

Companion
object
Source
ToExpr.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ArrayOfBooleanToExpr.type
object ArrayOfByteToExpr.type
object ArrayOfCharToExpr.type
object ArrayOfDoubleToExpr.type
object ArrayOfFloatToExpr.type
object ArrayOfIntToExpr.type
object ArrayOfLongToExpr.type
object ArrayOfShortToExpr.type
object BigDecimalToExpr.type
object BigIntToExpr.type
object EmptyTupleToExpr.type
object NilToExpr.type
object NoneToExpr.type
object StringContextToExpr.type
Show all
object ToExpr

Default given instances of ToExpr

Default given instances of ToExpr

Attributes

Companion
trait
Source
ToExpr.scala
Supertypes
class Object
trait Matchable
class Any
Self type
ToExpr.type
abstract class Type[T <: AnyKind]

Type (or type constructor) T needed contextually when using T in a quoted expression '{... T ...}

Type (or type constructor) T needed contextually when using T in a quoted expression '{... T ...}

Attributes

Companion
object
Source
Type.scala
Supertypes
class Object
trait Matchable
class Any
object Type

Methods to interact with the current Type[T] in scope

Methods to interact with the current Type[T] in scope

Attributes

Companion
class
Source
Type.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Type.type
object Varargs

Expression representation of literal sequence of expressions.

Expression representation of literal sequence of expressions.

Varargs can be used to create the an expression args that will be used as varargs '{ f($args: _*) } or it can be used to extract all the arguments of the a varargs.

Attributes

Source
Varargs.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Varargs.type

Value members

Concrete methods

transparent inline def quotes(using inline q: Quotes): Quotes

Current Quotes in scope

Current Quotes in scope

Usage:

import scala.quoted._
def myExpr[T](using Quotes): Expr[T] = {
   import quotes.reflect._
   ???
}

Attributes

Source
Quotes.scala