tpd

object tpd extends Instance[Type] with TypedTreeInfo

Some creators for typed trees

trait TreeInfo[Type]
class Instance[Type]
class Object
trait Matchable
class Any

Type members

Classlikes

final class Counter
class MapToUnderlying extends TreeMap

Map Inlined nodes, NamedArgs, Blocks with no statements and local references to underlying arguments. Also drops Inline and Block with no statements.

Map Inlined nodes, NamedArgs, Blocks with no statements and local references to underlying arguments. Also drops Inline and Block with no statements.

object MaybePoly

An extractor that pulls out type arguments

An extractor that pulls out type arguments

final class TreeOps[ThisTree <: Tree](tree: ThisTree) extends AnyVal

A trait for loaders that compute trees. Currently implemented just by DottyUnpickler.

A trait for loaders that compute trees. Currently implemented just by DottyUnpickler.

object TypeArgs

Inherited classlikes

Extractor for not-null assertions. A not-null assertion for reference x has the form x.$asInstanceOf$[x.type & T].

Extractor for not-null assertions. A not-null assertion for reference x has the form x.$asInstanceOf$[x.type & T].

Inherited from
TypedTreeInfo
class DeepFolder[X](f: (X, Tree) => X)

Fold f over all tree nodes, in depth-first, prefix order

Fold f over all tree nodes, in depth-first, prefix order

Inherited from
Instance
class MatchingArgs(params: List[Symbol], args: List[Tree])(using `x$3`: Context)
Inherited from
TreeInfo
object Quoted

Extractors for quotes

Extractors for quotes

Inherited from
TypedTreeInfo
class ShallowFolder[X](f: (X, Tree) => X)

Fold f over all tree nodes, in depth-first, prefix order, but don't visit subtrees where f returns a different result for the root, i.e. f(x, root) ne x.

Fold f over all tree nodes, in depth-first, prefix order, but don't visit subtrees where f returns a different result for the root, i.e. f(x, root) ne x.

Inherited from
Instance
object Spliced

Extractors for splices

Extractors for splices

Inherited from
TypedTreeInfo
object SplicedType

Extractors for type splices

Extractors for type splices

Inherited from
TypedTreeInfo
abstract class TreeAccumulator[X]
Inherited from
Instance
abstract class TreeCopier

A class for copying trees. The copy methods avoid creating a new tree If all arguments stay the same.

A class for copying trees. The copy methods avoid creating a new tree If all arguments stay the same.

Note: Some of the copy methods take a context. These are exactly those methods that are overridden in TypedTreeCopier so that they selectively retype themselves. Retyping needs a context.

Inherited from
Instance
abstract class TreeMap(val cpy: TreeCopier)
Inherited from
Instance
abstract class TreeTraverser
Inherited from
Instance
object TypeDefs
Inherited from
Instance
object ValDefs
Inherited from
Instance
object closure

An extractor for closures, either contained in a block or standalone.

An extractor for closures, either contained in a block or standalone.

Inherited from
TypedTreeInfo
object closureDef

An extractor for def of a closure contained the block of the closure.

An extractor for def of a closure contained the block of the closure.

Inherited from
TypedTreeInfo

Inherited types

Inherited from
Instance
Inherited from
Instance
type Apply = Apply[T]
Inherited from
Instance
type Assign = Assign[T]
Inherited from
Instance
type Bind = Bind[T]
Inherited from
Instance
type Block = Block[T]
Inherited from
Instance
Inherited from
Instance
type CaseDef = CaseDef[T]
Inherited from
Instance
type Closure = Closure[T]
Inherited from
Instance
type DefDef = DefDef[T]
Inherited from
Instance
type DefTree = DefTree[T]
Inherited from
Instance
Inherited from
Instance
type Export = Export[T]
Inherited from
Instance
Inherited from
Instance
type Ident = Ident[T]
Inherited from
Instance
type If = If[T]
Inherited from
Instance
type Import = Import[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type Inlined = Inlined[T]
Inherited from
Instance
Inherited from
Instance
type Labeled = Labeled[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type Literal = Literal[T]
Inherited from
Instance
type Match = Match[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type New = New[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type RefTree = RefTree[T]
Inherited from
Instance
type Return = Return[T]
Inherited from
Instance
type Select = Select[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type Super = Super[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type Thicket = Thicket[T]
Inherited from
Instance
type This = This[T]
Inherited from
Instance
type Tree = Tree[T]
Inherited from
Instance
type Try = Try[T]
Inherited from
Instance
type TypTree = TypTree[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type TypeDef = TypeDef[T]
Inherited from
Instance
Inherited from
Instance
type Typed = Typed[T]
Inherited from
Instance
type UnApply = UnApply[T]
Inherited from
Instance
type ValDef = ValDef[T]
Inherited from
Instance
Inherited from
Instance
Inherited from
Instance
type WhileDo = WhileDo[T]
Inherited from
Instance

Value members

Concrete methods

def Alternative(trees: List[Tree])(using Context): Alternative
def Annotated(arg: Tree, annot: Tree)(using Context): Annotated
def AnonClass(parents: List[Type], fns: List[TermSymbol], methNames: List[TermName])(using Context): Block

An anonymous class

An anonymous class

new parents { forwarders }

where forwarders contains forwarders for all functions in fns.

Value Params
fns

a non-empty of functions for which forwarders should be defined in the class. The class has the same owner as the first function in fns. Its position is the union of all functions in fns.

parents

a non-empty list of class types

def AppliedTypeTree(tycon: Tree, args: List[Tree])(using Context): AppliedTypeTree
def Apply(fn: Tree, args: List[Tree])(using Context): Apply
def Assign(lhs: Tree, rhs: Tree)(using Context): Assign
def Bind(sym: Symbol, body: Tree)(using Context): Bind
def BindTyped(sym: TermSymbol, tpe: Type)(using Context): Bind

A pattern corresponding to sym: tpe

A pattern corresponding to sym: tpe

def Block(stats: List[Tree], expr: Tree)(using Context): Block
def CaseDef(pat: Tree, guard: Tree, body: Tree)(using Context): CaseDef
def ClassDef(cls: ClassSymbol, constr: DefDef, body: List[Tree], superArgs: List[Tree])(using Context): TypeDef
def ClassDefWithParents(cls: ClassSymbol, constr: DefDef, parents: List[Tree], body: List[Tree])(using Context): TypeDef
def Closure(env: List[Tree], meth: Tree, tpt: Tree)(using Context): Closure
def Closure(meth: TermSymbol, rhsFn: List[List[Tree]] => Tree, targs: List[Tree], targetType: Type)(using Context): Block

A function def

A function def

vparams => expr

gets expanded to

{ def $anonfun(vparams) = expr; Closure($anonfun) }

where the closure's type is the target type of the expression (FunctionN, unless otherwise specified).

def DefDef(sym: TermSymbol, paramss: List[List[Symbol]], resultType: Type, rhs: Tree)(using Context): DefDef
def DefDef(sym: TermSymbol, rhs: Tree)(using Context): DefDef
def DefDef(sym: TermSymbol, rhsFn: List[List[Tree]] => Tree)(using Context): DefDef

A DefDef with given method symbol sym.

A DefDef with given method symbol sym.

def Export(expr: Tree, selectors: List[ImportSelector])(using Context): Export
def Ident(tp: NamedType)(using Context): Ident
def If(cond: Tree, thenp: Tree, elsep: Tree)(using Context): If
def Import(expr: Tree, selectors: List[ImportSelector])(using Context): Import
def InlineIf(cond: Tree, thenp: Tree, elsep: Tree)(using Context): If
def InlineMatch(selector: Tree, cases: List[CaseDef])(using Context): Match
def Inlined(call: Tree, bindings: List[MemberDef], expansion: Tree)(using Context): Inlined
def JavaSeqLiteral(elems: List[Tree], elemtpt: Tree)(using Context): JavaSeqLiteral
def Labeled(bind: Bind, expr: Tree)(using Context): Labeled
def Labeled(sym: TermSymbol, expr: Tree)(using Context): Labeled
def Lambda(tpe: MethodType, rhsFn: List[Tree] => Tree)(using Context): Block

A closure whole anonymous function has the given method type

A closure whole anonymous function has the given method type

def LambdaTypeTree(tparams: List[TypeDef], body: Tree)(using Context): LambdaTypeTree
def Literal(const: Constant)(using Context): Literal
def Match(selector: Tree, cases: List[CaseDef])(using Context): Match
def MatchTypeTree(bound: Tree, selector: Tree, cases: List[CaseDef])(using Context): MatchTypeTree
def ModuleDef(sym: TermSymbol, body: List[Tree])(using Context): Thicket

An object def

An object def

object obs extends parents { decls }

gets expanded to

val obj = new obj$ class obj$ extends parents { this: obj.type => decls }

(The following no longer applies: What's interesting here is that the block is well typed (because class obj$ is hoistable), but the type of the obj val is not expressible. What needs to happen in general when inferring the type of a val from its RHS, is: if the type contains a class that has the val itself as owner, then that class is remapped to have the val's owner as owner. Remapping could be done by cloning the class with the new owner and substituting everywhere in the tree. We know that remapping is safe because the only way a local class can appear in the RHS of a val is by being hoisted outside of a block, and the necessary checks are done at this point already.

On the other hand, for method result type inference, if the type of the RHS of a method contains a class owned by the method, this would be an error.)

def NamedArg(name: Name, arg: Tree)(using Context): NamedArg
def New(tpt: Tree)(using Context): New
def New(tp: Type)(using Context): New
def New(tp: Type, args: List[Tree])(using Context): Apply

new C(args), calling the primary constructor of C

new C(args), calling the primary constructor of C

def New(tp: Type, constr: TermSymbol, args: List[Tree])(using Context): Apply

new C(args), calling given constructor constr of C

new C(args), calling given constructor constr of C

def PackageDef(pid: RefTree, stats: List[Tree])(using Context): PackageDef
def RefinedTypeTree(parent: Tree, refinements: List[Tree], refineCls: ClassSymbol)(using Context): Tree
def Return(expr: Tree, from: Tree)(using Context): Return
def Return(expr: Tree, from: Symbol)(using Context): Return
def Select(qualifier: Tree, name: Name)(using Context): Select
def Select(qualifier: Tree, tp: NamedType)(using Context): Select
def SeqLiteral(elems: List[Tree], elemtpt: Tree)(using Context): SeqLiteral
def Super(qual: Tree, mix: Ident, mixinClass: Symbol)(using Context): Super
def Super(qual: Tree, mixName: TypeName, mixinClass: Symbol)(using Context): Super
def SyntheticValDef(name: TermName, rhs: Tree)(using Context): ValDef
def This(cls: ClassSymbol)(using Context): This
def Throw(expr: Tree)(using Context): Tree
def Try(block: Tree, cases: List[CaseDef], finalizer: Tree)(using Context): Try
def TypeApply(fn: Tree, args: List[Tree])(using Context): TypeApply
def TypeBoundsTree(lo: Tree, hi: Tree, alias: Tree)(using Context): TypeBoundsTree
def TypeDef(sym: TypeSymbol)(using Context): TypeDef
def TypeTree(tp: Type)(using Context): TypeTree
def Typed(expr: Tree, tpt: Tree)(using Context): Typed
def UnApply(fun: Tree, implicits: List[Tree], patterns: List[Tree], proto: Type)(using Context): UnApply
def Underscore(tp: Type)(using Context): Ident

A _ with given type

A _ with given type

def ValDef(sym: TermSymbol, rhs: LazyTree)(using Context): ValDef
def WhileDo(cond: Tree, body: Tree)(using Context): WhileDo
def addInlinedTrees(n: Int)(using Context): Unit

Record inlined trees

Record inlined trees

def clsOf(tp: Type)(using Context): Tree

A tree that corresponds to Predef.classOf[$tp] in source

A tree that corresponds to Predef.classOf[$tp] in source

def defaultValue(tpe: Type)(using Context): Tree
def desugarIdent(tree: Ident)(using Context): RefTree

Desugar identifier into a select node. Return the tree itself if not possible

Desugar identifier into a select node. Return the tree itself if not possible

def desugarIdentPrefix(tree: Ident)(using Context): Tree

Recover identifier prefix (e.g. this) if it exists

Recover identifier prefix (e.g. this) if it exists

All enclosing calls that are currently inlined, from innermost to outermost.

All enclosing calls that are currently inlined, from innermost to outermost.

def evalOnce(tree: Tree)(within: Tree => Tree)(using Context): Tree

Let bind tree unless tree is at least idempotent

Let bind tree unless tree is at least idempotent

The list of select trees that resolve to the same symbols as the ones that are imported by imp.

The list of select trees that resolve to the same symbols as the ones that are imported by imp.

def importedSymbols(expr: Tree, name: Name)(using Context): List[Symbol]

The symbols that are imported with expr.name

The symbols that are imported with expr.name

Value Params
expr

The base of the import statement

name

The name that is being imported.

Returns

All the symbols that would be imported with expr.name.

def importedSymbols(imp: Import, selectorPredicate: ImportSelector => Boolean)(using Context): List[Symbol]

All the symbols that are imported by the first selector of imp that matches selectorPredicate.

All the symbols that are imported by the first selector of imp that matches selectorPredicate.

Value Params
imp

The import statement to analyze

selectorPredicate

A test to find the selector to use.

Returns

The symbols imported.

override def inlineContext(call: Tree)(using Context): Context

Record an enclosing inlined call. EmptyTree calls (for parameters) cancel the next-enclosing call in the list instead of being added to it. We assume parameters are never nested inside parameters.

Record an enclosing inlined call. EmptyTree calls (for parameters) cancel the next-enclosing call in the list instead of being added to it. We assume parameters are never nested inside parameters.

Definition Classes
def joinArgs(targs: List[Tree], argss: List[List[Tree]]): List[List[Tree]]
def letBindUnless(level: PurityLevel, tree: Tree)(within: Tree => Tree)(using Context): Tree

If tree's purity level is less than level, let-bind it so that it gets evaluated only once. I.e. produce a

If tree's purity level is less than level, let-bind it so that it gets evaluated only once. I.e. produce a

{ val x = 'tree ; ~within('x) }

instead of otherwise

~within('tree)

def localCtx(tree: Tree)(using Context): Context

The local context to use when traversing trees

The local context to use when traversing trees

def localOwner(tree: Tree)(using Context): Symbol

The owner to be used in a local context when traversin a tree

The owner to be used in a local context when traversin a tree

def mkList(trees: List[Tree], tpe: Tree)(using Context): Tree

Create a tree representing a list containing all the elements of the argument list. A "list of tree to tree of list" conversion.

Create a tree representing a list containing all the elements of the argument list. A "list of tree to tree of list" conversion.

Value Params
tpe

the type of the elements of the resulting list.

trees

the elements the list represented by the resulting tree should contain.

def needsSelect(tp: Type)(using Context): Boolean

Creates the nested pairs type tree repesentation of the type trees in ts

Creates the nested pairs type tree repesentation of the type trees in ts

def newArray(elemTpe: Type, returnTpe: Type, span: Span, dims: JavaSeqLiteral)(using Context): Tree

A tree representing a newXYZArray operation of the right kind for the given element type in elemTpe. No type arguments or length arguments are given.

A tree representing a newXYZArray operation of the right kind for the given element type in elemTpe. No type arguments or length arguments are given.

def pathFor(tp: Type)(using Context): Tree

A path that corresponds to the given type tp. Error if tp is not a refinement of an addressable singleton type.

A path that corresponds to the given type tp. Error if tp is not a refinement of an addressable singleton type.

def primitiveConversion(tree: Tree, numericCls: Symbol)(using Context): Tree

Check if the limit on the number of inlined trees has been reached

Check if the limit on the number of inlined trees has been reached

def ref(tp: NamedType)(using Context): Tree

A tree representing the same reference as the given type

A tree representing the same reference as the given type

def ref(sym: Symbol)(using Context): Tree
def repeated(trees: List[Tree], tpt: Tree)(using Context): Tree

Convert a list of trees to a vararg-compatible tree. Used to make arguments for methods that accept varargs.

Convert a list of trees to a vararg-compatible tree. Used to make arguments for methods that accept varargs.

def runtimeCall(name: TermName, args: List[Tree])(using Context): Tree
def sameTypes(trees: List[Tree], trees1: List[Tree]): Boolean
def seq(stats: List[Tree], expr: Tree)(using Context): Tree

Join stats in front of expr creating a new block if necessary

Join stats in front of expr creating a new block if necessary

def singleton(tp: Type)(using Context): Tree
override def skipTransform(tree: Tree)(using Context): Boolean
Definition Classes
def sourceFile(call: Tree)(using Context): SourceFile

The source file where the symbol of the inline method referred to by call is defined

The source file where the symbol of the inline method referred to by call is defined

def splitArgs(argss: List[List[Tree]]): (List[Tree], List[List[Tree]])

Split argument clauses into a leading type argument clause if it exists and remaining clauses

Split argument clauses into a leading type argument clause if it exists and remaining clauses

def tupleTypeTree(elems: List[Tree])(using Context): Tree

Creates the tuple type tree repesentation of the type trees in ts

Creates the tuple type tree repesentation of the type trees in ts

def wrapArray(tree: Tree, elemtp: Type)(using Context): Tree

A tree representing a wrapXYZArray(tree) operation of the right kind for the given element type in elemTpe.

A tree representing a wrapXYZArray(tree) operation of the right kind for the given element type in elemTpe.

The wrapped array method name for an array of type elemtp

The wrapped array method name for an array of type elemtp

Inherited methods

def Thicket(xs: List[Tree])(implicit src: SourceFile): Thicket[Type]
Inherited from
Instance
def Thicket(x1: Tree, x2: Tree, x3: Tree)(implicit src: SourceFile): Thicket
Inherited from
Instance
def Thicket(x1: Tree, x2: Tree)(implicit src: SourceFile): Thicket
Inherited from
Instance
Inherited from
Instance
def allArgss(tree: Tree): List[List[Tree]]

The type and term arguments of a possibly curried call, in the order they are given

The type and term arguments of a possibly curried call, in the order they are given

Inherited from
TypedTreeInfo
def allParamSyms(ddef: DefDef)(using Context): List[Symbol]

All type and value parameter symbols of this DefDef

All type and value parameter symbols of this DefDef

Inherited from
TreeInfo
def applyOverloaded(receiver: Tree, method: TermName, args: List[Tree], targs: List[Type], expectedType: Type)(using parentCtx: Context): Tree

Construct the application $receiver.$method[$targs]($args) using overloading resolution to find a matching overload of $method if necessary. This is useful when overloading resolution needs to be performed in a phase after typer. Note that this will not perform any kind of implicit search.

Construct the application $receiver.$method[$targs]($args) using overloading resolution to find a matching overload of $method if necessary. This is useful when overloading resolution needs to be performed in a phase after typer. Note that this will not perform any kind of implicit search.

Value Params
expectedType

An expected type of the application used to guide overloading resolution

Inherited from
Instance
def arguments(tree: Tree): List[Tree]

The (last) list of arguments of an application

The (last) list of arguments of an application

Inherited from
TreeInfo
Inherited from
Instance
def assertAllPositioned(tree: Tree)(using Context): Unit
Inherited from
TypedTreeInfo
def catchesAllOf(cdef: CaseDef, threshold: Type)(using Context): Boolean

Does this CaseDef catch everything of a certain Type?

Does this CaseDef catch everything of a certain Type?

Inherited from
TreeInfo

Does this CaseDef catch Throwable?

Does this CaseDef catch Throwable?

Inherited from
TreeInfo
def closureBody(tree: Tree)(using Context): Tree

If tree is a closure, its body, otherwise tree itself

If tree is a closure, its body, otherwise tree itself

Inherited from
TypedTreeInfo
def constToLiteral(tree: Tree)(using Context): Tree

(1) If tree is a constant expression, its value as a Literal, or tree itself otherwise.

(1) If tree is a constant expression, its value as a Literal, or tree itself otherwise.

Note: Demanding idempotency instead of purity in literalize is strictly speaking too loose. Example

object O { final val x = 42; println("43") } O.x

Strictly speaking we can't replace O.x with 42. But this would make most expressions non-constant. Maybe we can change the spec to accept this kind of eliding behavior. Or else enforce true purity in the compiler. The choice will be affected by what we will do with inline and with Singleton type bounds (see SIP 23). Presumably

object O1 { val x: Singleton = 42; println("43") } object O2 { inline val x = 42; println("43") }

should behave differently.

O1.x should have the same effect as { println("43"); 42 }

whereas

O2.x = 42

Revisit this issue once we have standardized on inline. Then we can demand purity of the prefix unless the selection goes to a inline val.

Note: This method should be applied to all term tree nodes that are not literals, that can be idempotent, and that can have constant types. So far, only nodes of the following classes qualify:

  Ident
  Select
  TypeApply

(2) A primitive unary operator expression pre.op where op is one of +, -, ~, ! that has a constant type ConstantType(v) but that is not a constant expression (i.e. pre has side-effects) is translated to

{ pre; v }

(3) An expression pre.getClass[..]() that has a constant type ConstantType(v) but where pre has side-effects is translated to:

{ pre; v }

This avoids the situation where we have a Select node that does not have a symbol.

Inherited from
TypedTreeInfo

Decompose a template body into parameters and other statements

Decompose a template body into parameters and other statements

Inherited from
TypedTreeInfo
def defPath(sym: Symbol, root: Tree)(using Context): List[Tree]

Going from child to parent, the path of tree nodes that starts with a definition of symbol sym and ends with root, or Nil if no such path exists. Pre: sym must have a position.

Going from child to parent, the path of tree nodes that starts with a definition of symbol sym and ends with root, or Nil if no such path exists. Pre: sym must have a position.

Inherited from
TypedTreeInfo
def definedSym(tree: Tree)(using Context): Symbol

If tree is a DefTree, the symbol defined by it, otherwise NoSymbol

If tree is a DefTree, the symbol defined by it, otherwise NoSymbol

Inherited from
TypedTreeInfo
def definingStats(sym: Symbol)(using Context): List[Tree]

The statement sequence that contains a definition of sym, or Nil if none was found. For a tree to be found, The symbol must have a position and its definition tree must be reachable from come tree stored in an enclosing context.

The statement sequence that contains a definition of sym, or Nil if none was found. For a tree to be found, The symbol must have a position and its definition tree must be reachable from come tree stored in an enclosing context.

Inherited from
TypedTreeInfo
def exprPurity(tree: Tree)(using Context): PurityLevel

The purity level of this expression. See docs for PurityLevel for what that means

The purity level of this expression. See docs for PurityLevel for what that means

Note that purity and idempotency are treated differently. References to modules and lazy vals are impure (side-effecting) both because side-effecting code may be executed and because the first reference takes a different code path than all to follow; but they are idempotent because running the expression a second time gives the cached result.

Inherited from
TypedTreeInfo

The first constructor definition in stats

The first constructor definition in stats

Inherited from
TreeInfo
def flatTree(xs: List[Tree])(implicit src: SourceFile): Tree
Inherited from
Instance
def forallResults(tree: Tree, p: Tree => Boolean): Boolean

Checks whether predicate p is true for all result parts of this expression, where we zoom into Ifs, Matches, and Blocks.

Checks whether predicate p is true for all result parts of this expression, where we zoom into Ifs, Matches, and Blocks.

Inherited from
TreeInfo
def funPart(tree: Tree): Tree

The function part of a possibly curried call. Unlike methPart this one does not decompose blocks

The function part of a possibly curried call. Unlike methPart this one does not decompose blocks

Inherited from
TypedTreeInfo
def hasNamedArg(args: List[Any]): Boolean

Does this list contain a named argument tree?

Does this list contain a named argument tree?

Inherited from
TreeInfo

Is tree a backquoted identifier or definition

Is tree a backquoted identifier or definition

Inherited from
TreeInfo
def isCatchCase(cdef: CaseDef)(using Context): Boolean

Is this pattern node a catch-all or type-test pattern?

Is this pattern node a catch-all or type-test pattern?

Inherited from
TypedTreeInfo
Inherited from
TreeInfo

Is this pattern node a catch-all (wildcard or variable) pattern?

Is this pattern node a catch-all (wildcard or variable) pattern?

Inherited from
TreeInfo
def isExtMethodApply(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo

Is this case guarded?

Is this case guarded?

Inherited from
TreeInfo
def isIdempotentExpr(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo
def isIdempotentPath(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo
def isIdempotentRef(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo
def isOpAssign(tree: Tree): Boolean
Inherited from
TreeInfo
def isPath(tree: Tree): Boolean

Is tree a path?

Is tree a path?

Inherited from
TreeInfo
def isPureApply(tree: Tree, fn: Tree)(using Context): Boolean

Is the application tree with function part fn known to be pure? Function value and arguments can still be impure.

Is the application tree with function part fn known to be pure? Function value and arguments can still be impure.

Inherited from
TypedTreeInfo
def isPureBinding(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo
def isPureExpr(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo
def isPurePath(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo
def isPureRef(tree: Tree)(using Context): Boolean
Inherited from
TypedTreeInfo

Is tpt a vararg type of the form T* or => T*?

Is tpt a vararg type of the form T* or => T*?

Inherited from
TreeInfo
def isSelf(tree: Tree, enclClass: Symbol)(using Context): Boolean

Is tree a this node which belongs to enclClass?

Is tree a this node which belongs to enclClass?

Inherited from
TypedTreeInfo

Is tree a self constructor call this(...)? I.e. a call to a constructor of the same object?

Is tree a self constructor call this(...)? I.e. a call to a constructor of the same object?

Inherited from
TreeInfo
Inherited from
TreeInfo

Is this a (potentially applied) selection of a member of a structural type that is not a member of an underlying class or trait?

Is this a (potentially applied) selection of a member of a structural type that is not a member of an underlying class or trait?

Inherited from
TypedTreeInfo

Is tree a super constructor call?

Is tree a super constructor call?

Inherited from
TreeInfo
Inherited from
TreeInfo

Is this pattern node a synthetic catch-all case, added during PartialFuction synthesis before we know whether the user provided cases are exhaustive.

Is this pattern node a synthetic catch-all case, added during PartialFuction synthesis before we know whether the user provided cases are exhaustive.

Inherited from
TreeInfo
Inherited from
Instance
Inherited from
TreeInfo

Is this parameter list a using clause?

Is this parameter list a using clause?

Inherited from
TreeInfo
Inherited from
TreeInfo

Is tree a variable pattern?

Is tree a variable pattern?

Inherited from
TreeInfo

Is tree a reference to a mutable variable, or to a potential getter that has a setter in the same class?

Is tree a reference to a mutable variable, or to a potential getter that has a setter in the same class?

Inherited from
TypedTreeInfo

Is the argument a wildcard argument of the form _ or x @ _?

Is the argument a wildcard argument of the form _ or x @ _?

Inherited from
TreeInfo

Is this argument node of the form *, or is it a reference to such an argument ? The latter case can happen when an argument is lifted.

Is this argument node of the form *, or is it a reference to such an argument ? The latter case can happen when an argument is lifted.

Inherited from
TreeInfo

Does this argument list end with an argument of the form : _* ?

Does this argument list end with an argument of the form : _* ?

Inherited from
TreeInfo
def joinParams(tparams: List[TypeDef], paramss: List[ParamClause]): List[ParamClause]

If tparams is non-empty, add it to the left paramss, merging it with a leading type parameter list of paramss, if one exists.

If tparams is non-empty, add it to the left paramss, merging it with a leading type parameter list of paramss, if one exists.

Inherited from
Instance

If path looks like a language import, Some(name) where name is experimental if that sub-module is imported, and the empty term name otherwise.

If path looks like a language import, Some(name) where name is experimental if that sub-module is imported, and the empty term name otherwise.

Inherited from
TreeInfo
def localSyms(stats: List[Tree])(using Context): List[Symbol]

The symbols defined locally in a statement list

The symbols defined locally in a statement list

Inherited from
TypedTreeInfo

Is symbol potentially a getter of a mutable variable?

Is symbol potentially a getter of a mutable variable?

Inherited from
TypedTreeInfo
def methPart(tree: Tree): Tree

The method part of an application node, possibly enclosed in a block with only valdefs as statements. the reason for also considering blocks is that named arguments can transform a call into a block, e.g. (b = foo, a = bar) is transformed to { val x$1 = foo val x$2 = bar (x$2, x$1) }

The method part of an application node, possibly enclosed in a block with only valdefs as statements. the reason for also considering blocks is that named arguments can transform a call into a block, e.g. (b = foo, a = bar) is transformed to { val x$1 = foo val x$2 = bar (x$2, x$1) }

Inherited from
TreeInfo
def numArgs(tree: Tree): Int

The number of arguments in an application

The number of arguments in an application

Inherited from
TreeInfo
def parentsKind(parents: List[Tree])(using Context): FlagSet

The largest subset of {NoInits, PureInterface} that a trait or class with these parents can have as flags.

The largest subset of {NoInits, PureInterface} that a trait or class with these parents can have as flags.

Inherited from
TreeInfo
def patVars(tree: Tree)(using Context): List[Symbol]

The variables defined by a pattern, in reverse order of their appearance.

The variables defined by a pattern, in reverse order of their appearance.

Inherited from
TypedTreeInfo
def qualifier(tree: Tree)(using Context): Tree

The qualifier part of a Select or Ident. For an Ident, this is the This of the current class.

The qualifier part of a Select or Ident. For an Ident, this is the This of the current class.

Inherited from
TypedTreeInfo
def refPurity(tree: Tree)(using Context): PurityLevel

The purity level of this reference.

The purity level of this reference.

Returns

PurePath if reference is (nonlazy and stable) or to a parameterized function or its type is a constant type IdempotentPath if reference is lazy and stable Impure otherwise

Inherited from
TypedTreeInfo
def rename(tree: NameTree, newName: Name)(using Context): ThisTree[Type]
Inherited from
Instance
def resolveConstructor(atp: Type, args: List[Tree])(using Context): Tree
Inherited from
Instance
def sliceTopLevel(tree: Tree, cls: ClassSymbol)(using Context): List[Tree]

The tree containing only the top-level classes and objects matching either cls or its companion object

The tree containing only the top-level classes and objects matching either cls or its companion object

Inherited from
TypedTreeInfo
final def splitAtSuper(constrStats: List[Tree])(implicit ctx: Context): (List[Tree], List[Tree])

Return a pair consisting of (supercall, rest)

Return a pair consisting of (supercall, rest)

  • supercall: the superclass call, excluding trait constr calls

The supercall is always the first statement (if it exists)

Inherited from
TypedTreeInfo
def statPurity(tree: Tree)(using Context): PurityLevel

The purity level of this statement.

The purity level of this statement.

Returns

Pure if statement has no side effects Idempotent if running the statement a second time has no side effects Impure otherwise

Inherited from
TypedTreeInfo
def stripAnnotated(tree: Tree): Tree
Inherited from
TreeInfo
def stripApply(tree: Tree): Tree

If this is an application, its function part, stripping all Apply nodes (but leaving TypeApply nodes in). Otherwise the tree itself.

If this is an application, its function part, stripping all Apply nodes (but leaving TypeApply nodes in). Otherwise the tree itself.

Inherited from
TreeInfo
def stripBlock(tree: Tree): Tree

If this is a block, its expression part

If this is a block, its expression part

Inherited from
TreeInfo
def stripCast(tree: Tree)(using Context): Tree

Strips layers of .asInstanceOf[T] / _.$asInstanceOf[T]() from an expression

Strips layers of .asInstanceOf[T] / _.$asInstanceOf[T]() from an expression

Inherited from
TypedTreeInfo
def stripInlined(tree: Tree): Tree
Inherited from
TreeInfo
def termArgss(tree: Tree): List[List[Tree]]

The term arguments of a possibly curried call

The term arguments of a possibly curried call

Inherited from
TypedTreeInfo
Inherited from
Instance

The top level classes in this tree, including only those module classes that are not a linked class of some other class in the result.

The top level classes in this tree, including only those module classes that are not a linked class of some other class in the result.

Inherited from
TypedTreeInfo
def tupleArgs(tree: Tree)(using Context): List[Tree]

If tree is an instance of TupleN[...](e1, ..., eN), the arguments e1, ..., eN otherwise the empty list.

If tree is an instance of TupleN[...](e1, ..., eN), the arguments e1, ..., eN otherwise the empty list.

Inherited from
TypedTreeInfo
def typeArgss(tree: Tree): List[List[Tree]]

The type arguments of a possibly curried call

The type arguments of a possibly curried call

Inherited from
TypedTreeInfo
def unbind(x: Tree): Tree

The underlying pattern ignoring any bindings

The underlying pattern ignoring any bindings

Inherited from
TreeInfo
def unsplice(tree: Tree[Type]): Tree[Type]
Inherited from
TreeInfo

Concrete fields

inline val MapRecursionLimit: 10
override val cpy: TypedTreeCopier

Inherited fields

Inherited from
Instance
Inherited from
Instance
val isNamedArg: Any => Boolean
Inherited from
TreeInfo

Extensions

Extensions

extension (trees: List[Tree])
inline def mapInline(inline op: Tree => Tree): List[Tree]

A map that expands to a recursive function. It's equivalent to

A map that expands to a recursive function. It's equivalent to

flatten(trees.mapConserve(op))

and falls back to it after MaxRecursionLimit recursions. Before that it uses a simpler method that uses stackspace instead of heap. Note op is duplicated in the generated code, so it should be kept small.

extension (xs: List[Tree])
def tpes: List[Type]

Inherited extensions

extension (t1: Tree)
def ===(t2: Tree)(using Context): Boolean

Structural tree comparison (since == on trees is reference equality). For the moment, only Ident, Select, Literal, Apply and TypeApply are supported

Structural tree comparison (since == on trees is reference equality). For the moment, only Ident, Select, Literal, Apply and TypeApply are supported

Inherited from
TypedTreeInfo
def hash(using Context): Int

Structural tree comparison (since == on trees is reference equality). For the moment, only Ident, Select, Literal, Apply and TypeApply are supported

Structural tree comparison (since == on trees is reference equality). For the moment, only Ident, Select, Literal, Apply and TypeApply are supported

Inherited from
TypedTreeInfo