Packages

trait Expr[+T] extends Equals with Serializable

Expr wraps an abstract syntax tree and tags it with its type. The main source of information about exprs is the scala.reflect.api.Exprs page.

Source
Exprs.scala
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Expr
  2. Serializable
  3. Equals
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def actualType: Universe.Type

    Type of the wrapped expression tree as found in the underlying tree.

  2. abstract def in[U <: Universe with Singleton](otherMirror: Mirror[U]): in.U.Expr[T]

    Migrates the expression into another mirror, jumping into a different universe if necessary.

  3. abstract val mirror: Universe.Mirror

    Underlying mirror of this expr.

  4. abstract def splice: T

    A dummy method to mark expression splicing in reification.

    A dummy method to mark expression splicing in reification.

    It should only be used within a reify call, which eliminates the splice call and embeds the wrapped tree into the reified surrounding expression. If used alone splice throws an exception when called at runtime.

    If you want to use an Expr in reification of some Scala code, you need to splice it in. For an expr of type Expr[T], where T has a method foo, the following code

    reify{ expr.splice.foo }

    uses splice to turn an expr of type Expr[T] into a value of type T in the context of reify.

    It is equivalent to

    Select( expr.tree, TermName("foo") )

    The following example code however does not compile

    reify{ expr.foo }

    because expr of type Expr[T] itself does not have a method foo.

    Annotations
    @compileTimeOnly("splice must be enclosed within a reify {} block")
  5. abstract def staticType: Universe.Type

    Type of the wrapped expression tree as provided during creation.

    Type of the wrapped expression tree as provided during creation.

    When exprs are created by the compiler, staticType represents a statically known type of the tree as calculated at that point by the compiler.

  6. abstract def tree: Universe.Tree

    The Scala abstract syntax tree representing the wrapped expression.

  7. abstract val value: T

    A dummy value to denote cross-stage path-dependent type dependencies.

    A dummy value to denote cross-stage path-dependent type dependencies.

    For example for the following macro definition:

    class X { type T }
    object Macros { def foo(x: X): x.T = macro Impls.foo_impl }

    The corresponding macro implementation should have the following signature (note how the return type denotes path-dependency on x):

    object Impls { def foo_impl(c: Context)(x: c.Expr[X]): c.Expr[x.value.T] = ... }
    Annotations
    @compileTimeOnly("cannot use value except for signatures of macro implementations")

Concrete Value Members

  1. def canEqual(x: Any): Boolean
    Definition Classes
    Expr → Equals
  2. def equals(x: Any): Boolean
    Definition Classes
    Expr → Equals → AnyRef → Any
  3. def hashCode(): Int
    Definition Classes
    Expr → AnyRef → Any
  4. def toString(): String
    Definition Classes
    Expr → AnyRef → Any