TypedTreeInfo
Attributes
- Graph
-
- Supertypes
- Known subtypes
-
object tpd
- Self type
Members list
Type members
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]
.
Attributes
- Supertypes
- Self type
-
AssertNotNull.type
Attributes
- Supertypes
- Self type
-
ConstantValue.type
Attributes
- Supertypes
- Self type
-
QuotedTypeOf.type
Extractors for type splices
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.
Attributes
- Supertypes
- Self type
-
closureDef.type
Value members
Concrete methods
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
Attributes
If tree is a closure, its body, otherwise tree itself
If tree is a closure, its body, otherwise tree itself
Attributes
(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.
Attributes
Decompose a template body into parameters and other statements
Decompose a template body into parameters and other statements
Attributes
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.
Attributes
If tree
is a DefTree, the symbol defined by it, otherwise NoSymbol
If tree
is a DefTree, the symbol defined by it, otherwise NoSymbol
Attributes
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.
Attributes
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.
Attributes
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
Attributes
Is this pattern node a catch-all or type-test pattern?
Is this pattern node a catch-all or type-test pattern?
Attributes
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.
Attributes
Is tree a this
node which belongs to enclClass
?
Is tree a this
node which belongs to enclClass
?
Attributes
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?
Attributes
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?
Attributes
The symbols defined locally in a statement list
The symbols defined locally in a statement list
Attributes
Is symbol potentially a getter of a mutable variable?
Is symbol potentially a getter of a mutable variable?
Attributes
The variables defined by a pattern, in reverse order of their appearance.
The variables defined by a pattern, in reverse order of their appearance.
Attributes
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.
Attributes
The purity level of this reference.
The purity level of this reference.
Attributes
- 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
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
Attributes
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)
Attributes
The purity level of this statement.
The purity level of this statement.
Attributes
- Returns
-
Pure if statement has no side effects Idempotent if running the statement a second time has no side effects Impure otherwise
Strips layers of .asInstanceOf[T]
/ _.$asInstanceOf[T]()
from an expression
Strips layers of .asInstanceOf[T]
/ _.$asInstanceOf[T]()
from an expression
Attributes
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.
Attributes
Inherited methods
All term arguments of an application in a single flattened list
All type and value parameter symbols of this DefDef
Attributes
- Inherited from:
- TreeInfo
Does this CaseDef catch everything of a certain Type?
Does this CaseDef catch Throwable?
The first constructor definition in stats
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.
Attributes
- Inherited from:
- TreeInfo
Is tree explicitly parameterized with type arguments?
Does this list contain a named argument tree?
Is tree a backquoted identifier or definition
Is tree a type tree of the form => T
or (under pureFunctions) {refs}-> T
?
Is tree a type tree of the form => T
or (under pureFunctions) {refs}-> T
?
Attributes
- Inherited from:
- TreeInfo
Attributes
- 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?
Attributes
- Inherited from:
- TreeInfo
Is this case guarded?
Attributes
- Inherited from:
- TreeInfo
Is tree a path?
Is tpt a vararg type of the form T* or => T*?
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?
Attributes
- Inherited from:
- TreeInfo
Attributes
- Inherited from:
- TreeInfo
Is tree a super constructor call?
Attributes
- Inherited from:
- TreeInfo
Is tree an application with result this.type
? Accept b.addOne(x)
and also xs(i) += x
where the op is an assignment operator.
Is tree an application with result this.type
? Accept b.addOne(x)
and also xs(i) += x
where the op is an assignment operator.
Attributes
- Inherited from:
- TreeInfo
Attributes
- Inherited from:
- TreeInfo
Is this parameter list a using clause?
Attributes
- Inherited from:
- TreeInfo
Is tree a variable pattern?
Is the argument a wildcard argument of the form _
or x @ _
?
Is this argument node of the form
Is this argument node of the form
Attributes
- Inherited from:
- TreeInfo
Does this argument list end with an argument of the form
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.
Attributes
- Inherited from:
- TreeInfo
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.
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.
Attributes
- Inherited from:
- TreeInfo
The number of arguments in an application
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.
Attributes
- Inherited from:
- TreeInfo
Attributes
- Inherited from:
- TreeInfo
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.
Attributes
- Inherited from:
- TreeInfo
If this is a block, its expression part
Strip => T
to T
and (under pureFunctions) {refs}-> T
to T
Attributes
- Inherited from:
- TreeInfo
Attributes
- Inherited from:
- TreeInfo
The term arguments of a possibly curried call
The type arguments of a possibly curried call
The underlying pattern ignoring any bindings
Inherited fields
Attributes
- Inherited from:
- TreeInfo
Extensions
Extensions
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
Attributes
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