Trees

dotty.tools.dotc.ast.Trees
object Trees

Attributes

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

Members list

Type members

Classlikes

case class Alternative[+T <: Untyped] extends PatternTree[T]

tree_1 | ... | tree_n

tree_1 | ... | tree_n

Attributes

Supertypes
trait Serializable
trait PatternTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Annotated[+T <: Untyped] extends ProxyTree[T]

arg @annot

arg @annot

Attributes

Supertypes
trait Serializable
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class AppliedTypeTree[+T <: Untyped] extends ProxyTree[T], TypTree[T]

tpt[args]

tpt[args]

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Apply[+T <: Untyped] extends GenericApply[T]

fun(args)

fun(args)

Attributes

Supertypes
trait Serializable
class GenericApply[T]
trait TermTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
enum ApplyKind

The kind of application

The kind of application

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Assign[+T <: Untyped] extends TermTree[T]

name = arg, outside a parameter list

name = arg, outside a parameter list

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Bind[+T <: Untyped] extends NamedDefTree[T], PatternTree[T]

name @ body

name @ body

Attributes

Supertypes
trait Serializable
trait PatternTree[T]
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Block[+T <: Untyped] extends Tree[T]

{ stats; expr }

{ stats; expr }

Attributes

Supertypes
trait Serializable
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class XMLBlock
case class ByNameTypeTree[+T <: Untyped] extends TypTree[T]

=> T

=> T

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class CaseDef[+T <: Untyped] extends Tree[T]

case pat if guard => body

case pat if guard => body

Attributes

Supertypes
trait Serializable
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Closure[+T <: Untyped] extends TermTree[T]

A closure with an environment and a reference to a method.

A closure with an environment and a reference to a method.

Value parameters

env

The captured parameters of the closure

meth

A ref tree that refers to the method of the closure. The first (env.length) parameters of that method are filled with env values.

tpt

Either EmptyTree or a TypeTree. If tpt is EmptyTree the type of the closure is a function type, otherwise it is the type given in tpt, which must be a SAM type.

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class DefDef[+T <: Untyped] extends ValOrDefDef[T]

mods def nametparams...(vparams_n): tpt = rhs

mods def nametparams...(vparams_n): tpt = rhs

Attributes

Supertypes
trait Serializable
class ValOrDefDef[T]
class MemberDef[T]
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
trait DefTree[+T <: Untyped] extends DenotingTree[T]

Tree defines a new symbol

Tree defines a new symbol

Attributes

Supertypes
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class NamedDefTree[T]
class Bind[T]
class MemberDef[T]
class TypeDef[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[T]
class ModuleDef
class Template[T]
Show all
abstract class DenotingTree[+T <: Untyped](implicit src: SourceFile) extends Tree[T]

Tree's denotation can be derived from its type

Tree's denotation can be derived from its type

Attributes

Supertypes
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
trait DefTree[T]
class NamedDefTree[T]
class Bind[T]
class MemberDef[T]
class TypeDef[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[T]
class ModuleDef
class Template[T]
class ImportOrExport[T]
class Export[T]
class Import[T]
class NameTree[T]
class Labeled[T]
class RefTree[T]
class Ident[T]
object EmptyTypeIdent.type
class Select[T]
class SelectWithSig[T]
class This[T]
class TypeTree[T]
class InferredTypeTree[T]
class TermRefTree
class TypeRefTree
Show all
class EmptyTree[T <: Untyped] extends Thicket[Nothing]

Attributes

Supertypes
class Thicket[Nothing]
trait Serializable
trait WithoutTypeOrPos[Nothing]
class Tree[Nothing]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
class EmptyValDef[T <: Untyped] extends ValDef[T], WithoutTypeOrPos[T]

Attributes

Supertypes
trait WithoutTypeOrPos[T]
class ValDef[T]
trait Serializable
trait ValOrTypeDef[T]
class ValOrDefDef[T]
class MemberDef[T]
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Export[+T <: Untyped] extends ImportOrExport[T]

export expr.selectors where a selector is either an untyped Ident, name or an untyped thicket consisting of name and rename.

export expr.selectors where a selector is either an untyped Ident, name or an untyped thicket consisting of name and rename.

Attributes

Supertypes
trait Serializable
class ImportOrExport[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
abstract class GenericApply[+T <: Untyped](implicit src: SourceFile) extends ProxyTree[T], TermTree[T]

Attributes

Companion
object
Supertypes
trait TermTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Apply[T]
class TypeApply[T]
object GenericApply

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class Hole[+T <: Untyped](isTermHole: Boolean, idx: Int, args: List[Tree[T]], content: Tree[T], tpt: Tree[T])(implicit src: SourceFile) extends Tree[T]

Tree that replaces a level 1 splices in pickled (level 0) quotes. It is only used when picking quotes (will never be in a TASTy file).

Tree that replaces a level 1 splices in pickled (level 0) quotes. It is only used when picking quotes (will never be in a TASTy file).

Value parameters

args

The arguments of the splice to compute its content

content

Lambda that computes the content of the hole. This tree is empty when in a quote pickle.

idx

The index of the hole in it's enclosing level 0 quote.

isTermHole

If this hole is a term, otherwise it is a type hole.

tpt

Type of the hole

Attributes

Supertypes
trait Serializable
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Ident[+T <: Untyped] extends RefTree[T]

name

name

Attributes

Supertypes
trait Serializable
class RefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
object EmptyTypeIdent.type
case class If[+T <: Untyped] extends TermTree[T]

if cond then thenp else elsep

if cond then thenp else elsep

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class InlineIf[T]
case class Import[+T <: Untyped] extends ImportOrExport[T]

import expr.selectors where a selector is either an untyped Ident, name or an untyped thicket consisting of name and rename.

import expr.selectors where a selector is either an untyped Ident, name or an untyped thicket consisting of name and rename.

Attributes

Supertypes
trait Serializable
class ImportOrExport[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
abstract class ImportOrExport[+T <: Untyped](implicit src: SourceFile) extends DenotingTree[T]

Attributes

Supertypes
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Export[T]
class Import[T]
class InferredTypeTree[+T <: Untyped](implicit src: SourceFile) extends TypeTree[T]

A type tree whose type is inferred. These trees appear in two contexts

A type tree whose type is inferred. These trees appear in two contexts

  • as an argument of a TypeApply. In that case its type is always a TypeVar
  • as a (result-)type of an inferred ValDef or DefDef. Every TypeVar is created as the type of one InferredTypeTree.

Attributes

Supertypes
class TypeTree[T]
trait Serializable
trait TypTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
class InlineIf[+T <: Untyped] extends If[T]

Attributes

Supertypes
class If[T]
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
class InlineMatch[+T <: Untyped] extends Match[T]

Attributes

Supertypes
class Match[T]
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Inlined[+T <: Untyped] extends Tree[T]

A tree representing inlined code.

A tree representing inlined code.

Value parameters

bindings

Bindings for proxies to be used in the inlined code

call

Info about the original call that was inlined Until PostTyper, this is the full call, afterwards only a reference to the toplevel class from which the call was inlined.

expansion

The inlined tree, minus bindings. The full inlined code is equivalent to { bindings; expansion } The reason to keep bindings separate is because they are typed in a different context: bindings represent the arguments to the inlined call, whereas expansion represents the body of the inlined function.

Attributes

Supertypes
trait Serializable
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
abstract class Instance[T <: Untyped]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object tpd.type
object untpd.type
Self type
class JavaSeqLiteral[+T <: Untyped] extends SeqLiteral[T]

Array(elems)

Array(elems)

Attributes

Supertypes
class SeqLiteral[T]
trait Serializable
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Labeled[+T <: Untyped] extends NameTree[T]

label[tpt]: { expr }

label[tpt]: { expr }

Attributes

Supertypes
trait Serializable
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class LambdaTypeTree[+T <: Untyped] extends TypTree[T]

[typeparams] -> tpt

[typeparams] -> tpt

Note: the type of such a tree is not necessarily a HKTypeLambda, it can also be a TypeBounds where the upper bound is an HKTypeLambda, and the lower bound is either a reference to Nothing or an HKTypeLambda, this happens because these trees are typed by HKTypeLambda#fromParams which makes sure to move bounds outside of the type lambda itself to simplify their handling in the compiler.

You may ask: why not normalize the trees too? That way,

LambdaTypeTree(X, TypeBoundsTree(A, B))

would become,

TypeBoundsTree(LambdaTypeTree(X, A), LambdaTypeTree(X, B))

which would maintain consistency between a tree and its type. The problem with this definition is that the same tree X appears twice, therefore we'd have to create two symbols for it which makes it harder to relate the source code written by the user with the trees used by the compiler (for example, to make "find all references" work in the IDE).

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
trait Lazy[+T <: AnyRef]

A base trait for lazy tree fields. These can be instantiated with Lazy instances which can delay tree construction until the field is first demanded.

A base trait for lazy tree fields. These can be instantiated with Lazy instances which can delay tree construction until the field is first demanded.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class LazyReader[T]
case class Literal[+T <: Untyped] extends Tree[T], TermTree[T]

const

const

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Match[+T <: Untyped] extends TermTree[T]

selector match { cases }

selector match { cases }

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class InlineMatch[T]
case class MatchTypeTree[+T <: Untyped] extends TypTree[T]

[bound] selector match { cases }

[bound] selector match { cases }

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
abstract class MemberDef[+T <: Untyped](implicit src: SourceFile) extends NamedDefTree[T]

Tree defines a new symbol and carries modifiers. The position of a MemberDef contains only the defined identifier or pattern. The envelope of a MemberDef contains the whole definition and has its point on the opening keyword (or the next token after that if keyword is missing).

Tree defines a new symbol and carries modifiers. The position of a MemberDef contains only the defined identifier or pattern. The envelope of a MemberDef contains the whole definition and has its point on the opening keyword (or the next token after that if keyword is missing).

Attributes

Supertypes
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class TypeDef[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[T]
class ModuleDef
Show all
abstract class NameTree[+T <: Untyped](implicit src: SourceFile) extends DenotingTree[T]

Tree has a name

Tree has a name

Attributes

Supertypes
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Labeled[T]
class NamedDefTree[T]
class Bind[T]
class MemberDef[T]
class TypeDef[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[T]
class ModuleDef
class RefTree[T]
class Ident[T]
object EmptyTypeIdent.type
class Select[T]
class SelectWithSig[T]
Show all
case class NamedArg[+T <: Untyped] extends Tree[T]

name = arg, in a parameter list

name = arg, in a parameter list

Attributes

Supertypes
trait Serializable
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
abstract class NamedDefTree[+T <: Untyped](implicit src: SourceFile) extends NameTree[T], DefTree[T], WithEndMarker[T]

Attributes

Supertypes
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Bind[T]
class MemberDef[T]
class TypeDef[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[T]
class ModuleDef
Show all
case class New[+T <: Untyped] extends Tree[T], TermTree[T]

new tpt, but no constructor call

new tpt, but no constructor call

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class PackageDef[+T <: Untyped] extends ProxyTree[T], WithEndMarker[T]

package pid { stats }

package pid { stats }

Attributes

Supertypes
trait Serializable
trait WithEndMarker[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
trait PatternTree[+T <: Untyped] extends Tree[T]

Instances of this class are trees which are not terms but are legal parts of patterns.

Instances of this class are trees which are not terms but are legal parts of patterns.

Attributes

Supertypes
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Alternative[T]
class Bind[T]
class UnApply[T]
abstract class ProxyTree[+T <: Untyped](implicit src: SourceFile) extends Tree[T]

Tree's denot/isType/isTerm properties come from a subtree identified by forwardTo.

Tree's denot/isType/isTerm properties come from a subtree identified by forwardTo.

Attributes

Supertypes
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Annotated[T]
class AppliedTypeTree[T]
class GenericApply[T]
class Apply[T]
class TypeApply[T]
class PackageDef[T]
class RefinedTypeTree[T]
class Super[T]
class Typed[T]
class UnApply[T]
class Parens
class TypedSplice
Show all
case class Quote[+T <: Untyped] extends TermTree[T]

A tree representing a quote '{ body } or '[ body ]. Quotes are created by the Parser. In typer they can be typed as a Quote with a known tpt or desugared and typed as a quote pattern.

A tree representing a quote '{ body } or '[ body ]. Quotes are created by the Parser. In typer they can be typed as a Quote with a known tpt or desugared and typed as a quote pattern.

Quotes are checked and transformed in the staging, splicing and pickleQuotes phases. After pickleQuotes phase, the only quotes that exist are in inline methods. These are dropped when we remove the inline method implementations.

Type quotes '[body] from the parser are desugared into quote patterns (using a Type.of[T]]) when type checking. TASTy files will not contain type quotes. Type quotes are used again in the staging phase to represent the reification of Type.of[T]].

Value parameters

body

The tree that was quoted

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
abstract class RefTree[+T <: Untyped](implicit src: SourceFile) extends NameTree[T]

Tree refers by name to a denotation

Tree refers by name to a denotation

Attributes

Supertypes
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Ident[T]
object EmptyTypeIdent.type
class Select[T]
class SelectWithSig[T]
case class RefinedTypeTree[+T <: Untyped] extends ProxyTree[T], TypTree[T]

tpt { refinements }

tpt { refinements }

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Return[+T <: Untyped] extends TermTree[T]

return expr where from refers to the method or label from which the return takes place After program transformations this is not necessarily the enclosing method, because closures can intervene.

return expr where from refers to the method or label from which the return takes place After program transformations this is not necessarily the enclosing method, because closures can intervene.

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
class SearchFailureIdent[+T <: Untyped] extends Ident[T]

Attributes

Supertypes
class Ident[T]
trait Serializable
class RefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Select[+T <: Untyped] extends RefTree[T]

qualifier.name, or qualifier#name, if qualifier is a type

qualifier.name, or qualifier#name, if qualifier is a type

Attributes

Supertypes
trait Serializable
class RefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class SelectWithSig[T]
class SelectWithSig[+T <: Untyped] extends Select[T]

Attributes

Supertypes
class Select[T]
trait Serializable
class RefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class SeqLiteral[+T <: Untyped] extends Tree[T]

Seq(elems)

Seq(elems)

Value parameters

tpt

The element type of the sequence.

Attributes

Supertypes
trait Serializable
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class JavaSeqLiteral[T]
case class SingletonTypeTree[+T <: Untyped] extends DenotingTree[T], TypTree[T]

ref.type

ref.type

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Splice[+T <: Untyped] extends TermTree[T]

A tree representing a splice ${ expr }

A tree representing a splice ${ expr }

Splices are created by the Parser. In typer they can be typed as a Splice with a known tpt or desugared and typed as a quote pattern holes.

Splice are checked and transformed in the staging and splicing phases. After splicing phase, the only splices that exist are in inline methods. These are dropped when we remove the inline method implementations.

Value parameters

expr

The tree that was spliced

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Super[+T <: Untyped] extends ProxyTree[T], TermTree[T]

C.super[mix], where qual = C.this

C.super[mix], where qual = C.this

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class Template[+T <: Untyped] extends DefTree[T], WithLazyFields

extends parents { self => body }

extends parents { self => body }

Value parameters

preParentsOrDerived

A list of parents followed by a list of derived classes, if this is of class untpd.DerivingTemplate. Typed templates only have parents.

Attributes

Supertypes
trait Serializable
trait DefTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
case class TermLambdaTypeTree[+T <: Untyped] extends TypTree[T]

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
trait TermTree[+T <: Untyped] extends Tree[T]

Instances of this class are trees for which isTerm is definitely true. Note that some trees have isTerm = true without being TermTrees (e.g. Ident, Annotated)

Instances of this class are trees for which isTerm is definitely true. Note that some trees have isTerm = true without being TermTrees (e.g. Ident, Annotated)

Attributes

Supertypes
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Assign[T]
class Closure[T]
class GenericApply[T]
class Apply[T]
class TypeApply[T]
class If[T]
class InlineIf[T]
class Literal[T]
class Match[T]
class InlineMatch[T]
class New[T]
class Quote[T]
class Return[T]
class Splice[T]
class Super[T]
class This[T]
class Try[T]
class Typed[T]
class WhileDo[T]
Show all
case class Thicket[+T <: Untyped](trees: List[Tree[T]])(implicit src: SourceFile) extends Tree[T], WithoutTypeOrPos[T]

Temporary class that results from translation of ModuleDefs (and possibly other statements). The contained trees will be integrated when transformed with a transform(List[Tree]) call.

Temporary class that results from translation of ModuleDefs (and possibly other statements). The contained trees will be integrated when transformed with a transform(List[Tree]) call.

Attributes

Supertypes
trait Serializable
trait WithoutTypeOrPos[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class EmptyTree[T]
case class This[+T <: Untyped] extends DenotingTree[T], TermTree[T]

qual.this

qual.this

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
abstract class Tree[+T <: Untyped](implicit src: SourceFile) extends Positioned, SrcPos, Product, Container, Showable

Trees take a parameter indicating what the type of their tpe field is. Two choices: Type or Untyped. Untyped trees have type Tree[Untyped].

Trees take a parameter indicating what the type of their tpe field is. Two choices: Type or Untyped. Untyped trees have type Tree[Untyped].

Tree typing uses a copy-on-write implementation:

  • You can never observe a tpe which is null (throws an exception)
  • So when creating a typed tree with withType we can re-use the existing tree transparently, assigning its tpe field.
  • It is impossible to embed untyped trees in typed ones.
  • Typed trees can be embedded in untyped ones provided they are rooted in a TypedSplice node.
  • Type checking an untyped tree should remove all embedded TypedSplice nodes.

Attributes

Supertypes
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class Block[T]
class XMLBlock
class CaseDef[T]
class DenotingTree[T]
trait DefTree[T]
class NamedDefTree[T]
class Bind[T]
class MemberDef[T]
class TypeDef[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[T]
class ModuleDef
class Template[T]
class ImportOrExport[T]
class Export[T]
class Import[T]
class NameTree[T]
class Labeled[T]
class RefTree[T]
class Ident[T]
object EmptyTypeIdent.type
class Select[T]
class SelectWithSig[T]
class This[T]
class TypeTree[T]
class InferredTypeTree[T]
class TermRefTree
class TypeRefTree
class Hole[T]
class Inlined[T]
class Literal[T]
class NamedArg[T]
class New[T]
trait PatternTree[T]
class Alternative[T]
class UnApply[T]
class ProxyTree[T]
class Annotated[T]
class AppliedTypeTree[T]
class GenericApply[T]
class Apply[T]
class TypeApply[T]
class PackageDef[T]
class RefinedTypeTree[T]
class Super[T]
class Typed[T]
class Parens
class TypedSplice
class SeqLiteral[T]
class JavaSeqLiteral[T]
trait TermTree[T]
class Assign[T]
class Closure[T]
class If[T]
class InlineIf[T]
class Match[T]
class InlineMatch[T]
class Quote[T]
class Return[T]
class Splice[T]
class Try[T]
class WhileDo[T]
class Thicket[T]
class EmptyTree[T]
trait TypTree[T]
class ByNameTypeTree[T]
class LambdaTypeTree[T]
class MatchTypeTree[T]
class TypeBoundsTree[T]
trait WithoutTypeOrPos[T]
class ExtMethods
class Function
class GenAlias
class GenFrom
class Into
class MacroTree
class OpTree
class InfixOp
class PostfixOp
class PrefixOp
class PolyFunction
class Tuple
Show all
case class Try[+T <: Untyped] extends TermTree[T]

try block catch cases finally finalizer

try block catch cases finally finalizer

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
trait TypTree[+T <: Untyped] extends Tree[T]

Instances of this class are trees for which isType is definitely true. Note that some trees have isType = true without being TypTrees (e.g. Ident, Annotated)

Instances of this class are trees for which isType is definitely true. Note that some trees have isType = true without being TypTrees (e.g. Ident, Annotated)

Attributes

Supertypes
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class AppliedTypeTree[T]
class ByNameTypeTree[T]
class LambdaTypeTree[T]
class MatchTypeTree[T]
class RefinedTypeTree[T]
class TypeBoundsTree[T]
class TypeTree[T]
class InferredTypeTree[T]
class TermRefTree
class TypeRefTree
Show all
case class TypeApply[+T <: Untyped] extends GenericApply[T]

fun[args]

fun[args]

Attributes

Supertypes
trait Serializable
class GenericApply[T]
trait TermTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class TypeBoundsTree[+T <: Untyped] extends TypTree[T]

: lo <: hi : lo <: hi = alias for RHS of bounded opaque type

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class TypeDef[+T <: Untyped] extends MemberDef[T], ValOrTypeDef[T]

mods class name template or mods trait name template or mods type name = rhs or mods type name >: lo <: hi, if rhs = TypeBoundsTree(lo, hi) or mods type name >: lo <: hi = rhs if rhs = TypeBoundsTree(lo, hi, alias) and opaque in mods

mods class name template or mods trait name template or mods type name = rhs or mods type name >: lo <: hi, if rhs = TypeBoundsTree(lo, hi) or mods type name >: lo <: hi = rhs if rhs = TypeBoundsTree(lo, hi, alias) and opaque in mods

Attributes

Supertypes
trait Serializable
trait ValOrTypeDef[T]
class MemberDef[T]
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class TypeTree[+T <: Untyped]()(implicit src: SourceFile) extends DenotingTree[T], TypTree[T]

A type tree that represents an existing or inferred type

A type tree that represents an existing or inferred type

Attributes

Supertypes
trait Serializable
trait TypTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
case class Typed[+T <: Untyped] extends ProxyTree[T], TermTree[T]

expr : tpt

expr : tpt

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
case class UnApply[+T <: Untyped] extends ProxyTree[T], PatternTree[T]

The typed translation of extractor(patterns) in a pattern. The translation has the following components:

The typed translation of extractor(patterns) in a pattern. The translation has the following components:

Value parameters

fun

is extractor.unapply (or, for backwards compatibility, extractor.unapplySeq) possibly with type parameters

implicits

Any implicit parameters passed to the unapply after the selector

patterns

The argument patterns in the pattern match. It is typed with same type as first fun argument Given a match selector sel a pattern UnApply(fun, implicits, patterns) is roughly translated as follows val result = fun(sel)(implicits) if (result.isDefined) "match patterns against result"

Attributes

Supertypes
trait Serializable
trait PatternTree[T]
class ProxyTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
class UnAssignedTypeException[T <: Untyped](tree: Tree[T]) extends RuntimeException

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
case class ValDef[+T <: Untyped] extends ValOrDefDef[T], ValOrTypeDef[T]

mods val name: tpt = rhs

mods val name: tpt = rhs

Attributes

Supertypes
trait Serializable
trait ValOrTypeDef[T]
class ValOrDefDef[T]
class MemberDef[T]
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class EmptyValDef[T]
abstract class ValOrDefDef[+T <: Untyped](implicit src: SourceFile) extends MemberDef[T], WithLazyFields

A ValDef or DefDef tree

A ValDef or DefDef tree

Attributes

Supertypes
class MemberDef[T]
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[+T <: Untyped] extends MemberDef[T]

Attributes

Supertypes
class MemberDef[T]
class NamedDefTree[T]
trait WithEndMarker[T]
trait DefTree[T]
class NameTree[T]
class DenotingTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class TypeDef[T]
class ValDef[T]
class EmptyValDef[T]
case class WhileDo[+T <: Untyped] extends TermTree[T]

while (cond) { body }

while (cond) { body }

Attributes

Supertypes
trait Serializable
trait TermTree[T]
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
object WithEndMarker

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait WithEndMarker[+T <: Untyped]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class NamedDefTree[T]
class Bind[T]
class MemberDef[T]
class TypeDef[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
trait ValOrTypeDef[T]
class ModuleDef
class PackageDef[T]
Show all
Self type

A tree that can have a lazy fields. Such fields are variables of type T | Lazy[T], for some tyope T.

A tree that can have a lazy fields. Such fields are variables of type T | Lazy[T], for some tyope T.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Template[T]
class ValOrDefDef[T]
class DefDef[T]
class ValDef[T]
class EmptyValDef[T]
Show all
trait WithoutTypeOrPos[+T <: Untyped] extends Tree[T]

Attributes

Supertypes
class Tree[T]
trait Showable
trait Container
trait LinkSource
class Positioned
trait Cloneable
trait Product
trait Equals
trait SrcPos
class Object
trait Matchable
class Any
Show all
Known subtypes
class EmptyValDef[T]
class Thicket[T]
class EmptyTree[T]
object EmptyTypeIdent.type

Types

type LazyTree[+T <: Untyped] = Tree[T] | Lazy[Tree[T]]
type LazyTreeList[+T <: Untyped] = List[Tree[T]] | Lazy[List[Tree[T]]]
type ParamClause[T <: Untyped] = List[ValDef[T]] | List[TypeDef[T]]
type Untyped = Type | Null

Value members

Concrete methods

def flatten[T <: Untyped](trees: List[Tree[T]]): List[Tree[T]]

Concrete fields

Property key for backquoted identifiers and definitions

Property key for backquoted identifiers and definitions

Attributes

Property key for trees with documentation strings attached

Property key for trees with documentation strings attached

Attributes

var ntrees: Int

The total number of created tree nodes, maintained if Stats.enabled

The total number of created tree nodes, maintained if Stats.enabled

Attributes

Extensions

Extensions

extension (mdef: DefTree)