This class declares methods that are visible in a CompoundType (i.e.
This class declares methods that are visible in a CompoundType (i.e.
a class/trait/object template or refined type of the form
P_1 with ... with P_m { D_1; ...; D_n }
P_n
This class declares methods that are visible in a SingleType.
This class declares methods that are visible in a SingleType.
This class declares operations that are visible in a Type.
This class declares operations that are visible in a Type.
Alternatives of patterns, eliminated by explicitouter, except for occurrences in encoded Switch stmt (=remaining Match(CaseDef(...))
Alternatives of patterns, eliminated by explicitouter, except for occurrences in encoded Switch stmt (=remaining Match(CaseDef(...))
A tree that has an annotation attached to it.
A tree that has an annotation attached to it. Only used for annotated types and annotation ascriptions, annotations on definitions are stored in the Modifiers. Eliminated by typechecker (typedAnnotated), the annotations are then stored in an AnnotatedType.
A type carrying some annotations.
A type carrying some annotations. Created by the typechecker when eliminating Annotated trees (see typedAnnotated).
the list of annotations on the type
the type without the annotation
a "self" symbol with type underlying;
only available if -Yself-in-annots is turned on. Can be NoSymbol
if it is not used.
Typed information about an annotation.
Typed information about an annotation. It can be attached to either a symbol or an annotated type.
Annotations are written to the classfile as Java annotations
if atp conforms to ClassfileAnnotation (the classfile parser adds
this interface to any Java annotation class).
Annotations are pickled (written to scala symtab attribute in the
classfile) if atp inherits form StaticAnnotation.
args stores arguments to Scala annotations, represented as typed
trees. Note that these trees are not transformed by any phases
following the type-checker.
assocs stores arguments to classfile annotations as name-value pairs.
Applied type <tpt> [ <args> ], eliminated by RefCheck
Applied type <tpt> [ <args> ], eliminated by RefCheck
Value application
Value application
Dynamic value application.
Dynamic value application. In a dynamic application q.f(as)
Array of expressions, needs to be translated in backend,
Array of expressions, needs to be translated in backend,
Assignment
Assignment
Bind of a variable to a rhs pattern, eliminated by explicitouter
Block of expressions (semicolon separated expressions)
Block of expressions (semicolon separated expressions)
Case clause in a pattern match, eliminated during explicitouter (except for occurrences in switch statements)
Case clause in a pattern match, eliminated during explicitouter (except for occurrences in switch statements)
A class definition.
A class definition.
A class representing a class info
A class representing a class info
An extractor class to create and pattern match with syntax ClassInfo(parents, decls, clazz)
Here, parents is the list of parent types of the class, decls is the scope
containing all declarations in the class, and clazz is the symbol of the class
itself.
An extractor class to create and pattern match with syntax ClassInfo(parents, decls, clazz)
Here, parents is the list of parent types of the class, decls is the scope
containing all declarations in the class, and clazz is the symbol of the class
itself.
A class for class symbols
A class for class symbols
Arguments to classfile annotations (which are written to bytecode as java annotations) are either:
Arguments to classfile annotations (which are written to bytecode as java annotations) are either:
Commented expression
Commented expression
A common base class for intersection types and class types
A common base class for intersection types and class types
Intersection type <parent1> with ...
Intersection type <parent1> with ... with <parentN> { <decls> }, eliminated by RefCheck
A class representing a constant type.
An extractor class to create and pattern match with syntax ConstantType(constant)
Here, constant is the constant value represented by the type.
An extractor class to create and pattern match with syntax ConstantType(constant)
Here, constant is the constant value represented by the type.
A method or macro definition.
A method or macro definition.
The name of the method or macro. Can be a type name in case this is a type macro
A tree which defines a symbol-carrying entity.
A tree which defines a symbol-carrying entity.
A tree for a function expression.
A tree for a function expression.
Anonymous function, eliminated by analyzer
Anonymous function, eliminated by analyzer
Common base class for Apply and TypeApply.
Common base class for Apply and TypeApply. This could in principle be a SymTree, but whether or not a Tree is a SymTree isn't used to settle any interesting questions, and it would add a useless field to all the instances (useless, since GenericApply forwards to the underlying fun.)
Identifier <name>
Identifier <name>
Conditional expression
Conditional expression
A common base class for class and object definitions.
A common base class for class and object definitions.
Import clause
Import selector
Import selector
Representation of an imported name its optional rename and their optional positions
the imported name
its position or -1 if undefined
the name the import is renamed to (== name if no renaming)
the position of the rename or -1 if undefined
Infix application
Infix application
Infix extraction, for example case x :: rest
Infix extraction, for example case x :: rest
This should be the first trait in the linearization.
This should be the first trait in the linearization.
A labelled expression.
A labelled expression. Not expressible in language syntax, but generated by the compiler to simulate while/do-while loops, and also by the pattern matcher.
The label acts much like a nested function, where params represents
the incoming parameters. The symbol given to the LabelDef should have
a MethodType, as if it were a nested function.
Jumps are apply nodes attributed with a label's symbol. The arguments from the apply node will be passed to the label and assigned to the Idents.
Forward jumps within a block are allowed.
Literal
Literal
Represents a compile-time Constant (Boolean, Byte, Short,
Char, Int, Long, Float, Double, String, java.lang.Class or
an instance of a Java enumeration value).
Represents a compile-time Constant (Boolean, Byte, Short,
Char, Int, Long, Float, Double, String, java.lang.Class or
an instance of a Java enumeration value).
- Pattern matching expression (before explicitouter)
- Pattern matching expression (before explicitouter)
After explicitouter, cases will satisfy the following constraints:
EmptyTree,Literal(Constant(x:Int))
or Alternative(lit|...|lit)Ident(nme.WILDCARD)
Common base class for all member definitions: types, classes, objects, packages, vals and vars, defs.
Common base class for all member definitions: types, classes, objects, packages, vals and vars, defs.
A class for method symbols
A class for method symbols
A class representing a method type with parameters.
A class representing a method type with parameters. Note that a parameterless method is represented by a NullaryMethodType:
def m(): Int MethodType(Nil, Int) def m: Int NullaryMethodType(Int)
An extractor class to create and pattern match with syntax MethodType(params, respte)
Here, params is a potentially empty list of parameter symbols of the method,
and restpe is the result type of the method.
An extractor class to create and pattern match with syntax MethodType(params, respte)
Here, params is a potentially empty list of parameter symbols of the method,
and restpe is the result type of the method. If the method is curried, restpe would
be another MethodType.
Note: MethodType(Nil, Int) would be the type of a method defined with an empty parameter list.
def f(): Int
If the method is completely parameterless, as in
def f: Int
its type is a NullaryMethodType.
the qualifier for a private (a type name) or tpnme.EMPTY, if none is given.
the annotations for the definition. Note: the typechecker drops these annotations, use the AnnotationInfo's (Symbol.annotations) in later phases.
A class for module class symbols Note: Not all module classes are of this type; when unpickled, we get plain class symbols!
A class for module class symbols Note: Not all module classes are of this type; when unpickled, we get plain class symbols!
An object definition, e.g.
An object definition, e.g. object Foo. Internally, objects are
quite frequently called modules to reduce ambiguity.
A class for module symbols
A class for module symbols
A class representing types with a name.
A class representing types with a name. When an application uses named arguments, the named argument types for calling isApplicable are represented as NamedType.
Object instantiation One should always use factory method below to build a user level new.
Object instantiation One should always use factory method below to build a user level new.
a class type
A class containing the alternatives and type prefix of an overloaded symbol.
A class containing the alternatives and type prefix of an overloaded symbol.
Not used after phase typer.
A packaging, such as package pid { stats }
A packaging, such as package pid { stats }
A class representing a path dependent type
A class representing a path dependent type
A type function or the type of a polymorphic value (and thus of kind *).
A type function or the type of a polymorphic value (and thus of kind *).
Before the introduction of NullaryMethodType, a polymorphic nullary method (e.g, def isInstanceOf[T]: Boolean) used to be typed as PolyType(tps, restpe), and a monomorphic one as PolyType(Nil, restpe) This is now: PolyType(tps, NullaryMethodType(restpe)) and NullaryMethodType(restpe) by symmetry to MethodTypes: PolyType(tps, MethodType(params, restpe)) and MethodType(params, restpe)
Thus, a PolyType(tps, TypeRef(...)) unambiguously indicates a type function (which results from eta-expanding a type constructor alias). Similarly, PolyType(tps, ClassInfoType(...)) is a type constructor.
A polytype is of kind * iff its resultType is a (nullary) method type.
A procedure definition.
A procedure definition. Sugar for a function whose return type is Unit.
The name of the method or macro. Can be a type name in case this is a type macro
A tree which references a symbol-carrying entity.
A tree which references a symbol-carrying entity. References one, as opposed to defining one; definitions are in DefTrees.
A class representing intersection types with refinements of the form
<parents_0> with ... with <parents_n> { decls }
Cannot be created directly;
one should always use refinedType for creation.
A class representing intersection types with refinements of the form
<parents_0> with ... with <parents_n> { decls }
Cannot be created directly;
one should always use refinedType for creation.
An extractor class to create and pattern match with syntax RefinedType(parents, decls)
Here, parents is the list of parent types of the class, and decls is the scope
containing all declarations in the class.
An extractor class to create and pattern match with syntax RefinedType(parents, decls)
Here, parents is the list of parent types of the class, and decls is the scope
containing all declarations in the class.
Return expression
Return expression
Designator <qualifier> .
Designator <qualifier> . <name>
Type selection <qualifier> # <name>, eliminated by RefCheck
Type selection <qualifier> # <name>, eliminated by RefCheck
A proxy for a type (identified by field underlying) that forwards most
operations to it (for exceptions, see WrappingProxy, which forwards even more operations).
A proxy for a type (identified by field underlying) that forwards most
operations to it (for exceptions, see WrappingProxy, which forwards even more operations).
every operation that is overridden for some kind of types should be forwarded.
A class for singleton types of the form <prefix>.<sym.name>.type.
A class for singleton types of the form <prefix>.<sym.name>.type.
Cannot be created directly; one should always use singleType for creation.
An extractor class to create and pattern match with syntax SingleType(pre, sym)
Here, pre is the prefix of the single-type, and sym is the stable value symbol
referred to by the single-type.
An extractor class to create and pattern match with syntax SingleType(pre, sym)
Here, pre is the prefix of the single-type, and sym is the stable value symbol
referred to by the single-type.
Singleton type, eliminated by RefCheck
Singleton type, eliminated by RefCheck
Repetition of pattern, eliminated by explicitouter
Repetition of pattern, eliminated by explicitouter
A base class for types that defer some operations to their immediate supertype.
A base class for types that defer some operations to their immediate supertype.
Super reference, qual = corresponding this reference
Super reference, qual = corresponding this reference
An extractor class to create and pattern match with syntax SingleType(thistpe, supertpe)
An extractor class to create and pattern match with syntax SingleType(thistpe, supertpe)
A tree with a mutable symbol field, initialized to NoSymbol.
A tree with a mutable symbol field, initialized to NoSymbol.
Instantiation template of a class or trait
A class for term symbols
A class for term symbols
A tree for a term.
A tree for a term. Not all terms are TermTrees; use isTerm to reliably identify terms.
Self reference
Self reference
A class for this-types of the form <sym>.this.type
A class for this-types of the form <sym>.this.type
An extractor class to create and pattern match with syntax ThisType(sym)
where sym is the class prefix of the this type.
An extractor class to create and pattern match with syntax ThisType(sym)
where sym is the class prefix of the this type.
Throw expression
Throw expression
Tree is the basis for scala's abstract syntax.
Tree is the basis for scala's abstract syntax. The nodes are implemented as case classes, and the parameters which initialize a given tree are immutable: however Trees have several mutable fields which are manipulated in the course of typechecking, including pos, symbol, and tpe.
Newly instantiated trees have tpe set to null (though it
may be set immediately thereafter depending on how it is
constructed.) When a tree is passed to the typer, typically via
typer.typed(tree), under normal circumstances the tpe must be
null or the typer will ignore it. Furthermore, the typer is not
required to return the same tree it was passed.
Trees can be easily traversed with e.g. foreach on the root node; for a more nuanced traversal, subclass Traverser. Transformations can be considerably trickier: see the numerous subclasses of Transformer found around the compiler.
Copying Trees should be done with care depending on whether it need be done lazily or strictly (see LazyTreeCopier and StrictTreeCopier) and on whether the contents of the mutable fields should be copied. The tree copiers will copy the mutable attributes to the new tree; calling Tree#duplicate will copy symbol and tpe, but all the positions will be focused.
Trees can be coarsely divided into four mutually exclusive categories:
TypTree, not TypeTree.SymTrees include important nodes Ident and Select, which are used as both terms and types; they are distinguishable based on whether the Name is a TermName or TypeName. The correct way for to test for a type or a term (on any Tree) are the isTerm/isType methods on Tree.
"Others" are mostly syntactic or short-lived constructs. Examples include CaseDef, which wraps individual match cases: they are neither terms nor types, nor do they carry a symbol. Another example is Parens, which is eliminated during parsing.
A tree for a type.
A tree for a type. Not all types are TypTrees; use isType to reliably identify types.
The base class for all types
The base class for all types
Explicit type application.
Explicit type application. All signs point toward it being a requirement that args.nonEmpty, but I can't find that explicitly stated anywhere. Unless your last name is odersky, you should probably treat it as true.
A class for the bounds of abstract types and type parameters
A class for the bounds of abstract types and type parameters
An extractor class to create and pattern match with syntax TypeBound(lower, upper)
Here, lower is the lower bound of the TypeBounds pair, and upper is
the upper bound.
An extractor class to create and pattern match with syntax TypeBound(lower, upper)
Here, lower is the lower bound of the TypeBounds pair, and upper is
the upper bound.
A class expressing upper and lower bounds constraints of type variables, as well as their instantiations.
A class expressing upper and lower bounds constraints of type variables, as well as their instantiations.
An abstract type, a type parameter, or a type alias.
An abstract type, a type parameter, or a type alias.
A class for named types of the form
<prefix>.<sym.name>[args]
Cannot be created directly; one should always use typeRef
for creation.
A class for named types of the form
<prefix>.<sym.name>[args]
Cannot be created directly; one should always use typeRef
for creation.
...
...
...
An extractor class to create and pattern match with syntax TypeRef(pre, sym, args)
Here, pre is the prefix of the type reference, sym is the symbol
referred to by the type reference, and args is a possible empty list of
type argumenrts.
An extractor class to create and pattern match with syntax TypeRef(pre, sym, args)
Here, pre is the prefix of the type reference, sym is the symbol
referred to by the type reference, and args is a possible empty list of
type argumenrts.
A synthetic tree holding an arbitrary type.
A synthetic tree holding an arbitrary type. Not to be confused with
with TypTree, the trait for trees that are only used for type trees.
TypeTree's are inserted in several places, but most notably in
RefCheck, where the arbitrary type trees are all replaced by
TypeTree's.
A class representing a type variable: not used after phase typer.
A class representing a type variable: not used after phase typer.
A higher-kinded TypeVar has params (Symbols) and typeArgs (Types). A TypeVar with nonEmpty typeArgs can only be instantiated by a higher-kinded type that can be applied to those args. A TypeVar is much like a TypeRef, except it has special logic for equality and subtyping.
Type annotation, eliminated by explicit outer
Type annotation, eliminated by explicit outer
A constant value definition (this includes vars as well, which differ from vals only in having the MUTABLE flag set in their Modifiers.)
A constant value definition (this includes vars as well, which differ from vals only in having the MUTABLE flag set in their Modifiers.)
A common base class for ValDefs and DefDefs.
A common base class for ValDefs and DefDefs.
Block factory that flattens directly nested blocks.
Block factory that flattens directly nested blocks.
casedef shorthand
casedef shorthand
The constructor/deconstructor for ClassInfoType instances.
A writer that writes to the current Console and is sensitive to replacement of the Console's output stream.
A writer that writes to the current Console and is sensitive to replacement of the Console's output stream.
The constructor/deconstructor for ConstantType instances.
The empty scope (immutable).
The empty scope (immutable).
The empty tree
The empty tree
An object representing an erroneous type
An object representing an erroneous type
A TypeDef node which defines abstract type or type parameter for given sym
A TypeDef node which defines abstract type or type parameter for given sym
The constructor/deconstructor for MethodType instances.
the class symbol
the implementation template
0-1 argument list new, based on a symbol.
0-1 argument list new, based on a symbol.
Factory method for object creation new tpt(args_1)...(args_n)
A New(t, as) is expanded to: (new t).<init>(as)
Factory method for object creation new tpt(args_1)...(args_n)
A New(t, as) is expanded to: (new t).<init>(as)
An object representing a non-existing prefix
An object representing a non-existing type
The constructor/deconstructor for RefinedType instances.
The constructor/deconstructor for SingleType instances.
The constructor/deconstructor for SuperType instances.
The constructor/deconstructor for ThisType instances.
The constructor/deconstructor for TypeBounds instances.
A TypeDef node which defines given sym with given tight hand side rhs.
A TypeDef node which defines given sym with given tight hand side rhs.
The constructor/deconstructor for TypeRef instances.
An object representing an unknown type, used during type inference.
An object representing an unknown type, used during type inference. If you see WildcardType outside of inference it is almost certainly a bug.
Creator for AnnotatedTypes.
Creator for AnnotatedTypes. It returns the underlying type if annotations.isEmpty rather than walking into the assertion.
A creator for type applications
A creator for type applications
Turns a path into a String, introducing backquotes as necessary.
Turns a path into a String, introducing backquotes as necessary.
Again avoiding calling length, but the lengthCompare interface is clunky.
Again avoiding calling length, but the lengthCompare interface is clunky.
The maximum number of recursions allowed in toString
The maximum number of recursions allowed in toString
Cast tree to pt, unless tpe is a subtype of pt, or pt is Unit.
Cast tree to pt, unless tpe is a subtype of pt, or pt is Unit.
If this is a reference to a method with an empty parameter list, wrap it in an apply.
If this is a reference to a method with an empty parameter list, wrap it in an apply.
Builds a cast with given value and type.
Builds a cast with given value and type.
Builds a reference to value whose type is given stable prefix.
Builds a reference to value whose type is given stable prefix. If the type is unsuitable, e.g. it is a TypeRef for an abstract type variable, then an Ident will be made using termSym as the Ident's symbol. In that case, termSym must not be NoSymbol.
Builds a reference to value whose type is given stable prefix.
Builds a reference to value whose type is given stable prefix. The type must be suitable for this. For example, it must not be a TypeRef pointing to an abstract type variable.
Builds a reference to given symbol.
Builds a reference to given symbol.
Builds a reference to given symbol with given stable prefix.
Builds a reference to given symbol with given stable prefix.
Builds a reference with stable type to given symbol
Builds a reference with stable type to given symbol
Cast tree to type pt
Cast tree to type pt
Apparently we smuggle a Type around as a Literal(Constant(tp)) and the implementation of Constant#tpe is such that x.tpe becomes ClassType(value.asInstanceOf[Type]), i.e.
Apparently we smuggle a Type around as a Literal(Constant(tp)) and the implementation of Constant#tpe is such that x.tpe becomes ClassType(value.asInstanceOf[Type]), i.e. java.lang.Class[Type]. Can't find any docs on how/why it's done this way. See ticket SI-490 for some interesting comments from lauri alanko suggesting that the type given by classOf[T] is too strong and should be weakened so as not to suggest that classOf[List[String]] is any different from classOf[List[Int]].
!!! See deconstMap in Erasure for one bug this encoding has induced: I would be very surprised if there aren't more.
Builds an instance test with given value and type.
Builds an instance test with given value and type.
A creator for method calls, e.g.
A creator for method calls, e.g. fn[T1, T2, ...](v1, v2, ...) There are a number of variations.
symbol of the method receiver
name of the method to call
type arguments (if Nil, no TypeApply node will be generated)
value arguments
the newly created trees.
Builds a list with given head and tail.
Builds a list with given head and tail.
Builds a list with given head and tail.
Builds a list with given head and tail.
Builds a tuple
Builds a tuple
Builds a type application node if args.nonEmpty, returns fun otherwise.
Builds a type application node if args.nonEmpty, returns fun otherwise.
Builds an untyped reference to given symbol.
Builds an untyped reference to given symbol.
Builds a tree representing an undefined local, as in var x: T = _ which is appropriate to the given Type.
Builds a tree representing an undefined local, as in var x: T = _ which is appropriate to the given Type.
Create a new scope
Hook to define what show(tree) means.
Hook to define what show(tree) means.
Adds backticks if the name is a scala keyword.
Adds backticks if the name is a scala keyword.
the canonical creator for a refined type with a given scope
the canonical creator for a refined type with a given scope
True if two lists have the same length.
True if two lists have the same length. Since calling length on linear sequences is O(n), it is an inadvisable way to test length equality.
The canonical creator for single-types
The canonical creator for single-types
Hook for extensions
Hook for extensions