Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.quoted

scala.quoted

Members list

Packages

Type members

Classlikes

abstractclassExpr[+T]

Quoted expression of typeT.

Quoted expression of typeT.

Expr has extension methods that are defined inscala.quoted.Quotes.

Attributes

Companion
object
Source
Expr.scala
Supertypes
classObject
traitMatchable
classAny
objectExpr

Constructors for expressions

Constructors for expressions

Attributes

Companion
class
Source
Expr.scala
Supertypes
classObject
traitMatchable
classAny
Self type
Expr.type
traitExprMap

Attributes

Source
ExprMap.scala
Supertypes
classObject
traitMatchable
classAny
objectExprs

Attributes

Source
Exprs.scala
Supertypes
classObject
traitMatchable
classAny
Self type
Exprs.type
traitFromExpr[T]

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.

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

Attributes

Companion
object
Source
FromExpr.scala
Supertypes
classObject
traitMatchable
classAny
Known subtypes
objectFromExpr

Default given instances ofFromExpr

Default given instances ofFromExpr

Attributes

Companion
trait
Source
FromExpr.scala
Supertypes
classObject
traitMatchable
classAny
Self type
traitQuotes

Quotation 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] = '{ ... }

Attributes

Source
Quotes.scala
Supertypes
classObject
traitMatchable
classAny
Self type
traitToExpr[T]

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.

Attributes

Companion
object
Source
ToExpr.scala
Supertypes
classObject
traitMatchable
classAny
Known subtypes
objectToExpr

Default given instances ofToExpr

Default given instances ofToExpr

Attributes

Companion
trait
Source
ToExpr.scala
Supertypes
classObject
traitMatchable
classAny
Self type
ToExpr.type
abstractclassType[T <:AnyKind]

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 ...}

Attributes

Companion
object
Source
Type.scala
Supertypes
classObject
traitMatchable
classAny
objectType

Methods to interact with the currentType[T] in scope

Methods to interact with the currentType[T] in scope

Attributes

Companion
class
Source
Type.scala
Supertypes
classObject
traitMatchable
classAny
Self type
Type.type
objectVarargs

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.

Attributes

Source
Varargs.scala
Supertypes
classObject
traitMatchable
classAny
Self type
Varargs.type

Value members

Concrete methods

transparent inlinedefquotes(usingq:Quotes): q.type

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
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp