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(.
A tree that has an annotation attached to it.
Applied type <tpt> [ <args> ], eliminated by RefCheck
Value application
Dynamic value application.
Array of expressions, needs to be translated in backend,
Assignment
Either an assignment or a named argument.
Bind of a variable to a rhs pattern, eliminated by explicitouter
Block of expressions (semicolon separated expressions)
BoundedWildcardTypes, used only during type inference, are created in two places that I can find:
BoundedWildcardTypes, used only during type inference, are created in two places that I can find:
Case clause in a pattern match, eliminated during explicitouter (except for occurrences in switch statements)
A class definition.
The ClassInfo
type signature is used to define parents and declarations
of classes, traits, and objects.
The ClassInfo
type signature is used to define parents and declarations
of classes, traits, and objects. If a class, trait, or object C is declared like this
C extends P_1 with ... with P_m { D_1; ...; D_n}
its ClassInfo
type has the following form:
ClassInfo(List(P_1, ..., P_m), Scope(D_1, ..., D_n), C)
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 subtype of Type representing refined types as well as ClassInfo
signatures.
A subtype of Type representing refined types as well as ClassInfo
signatures.
Intersection type <parent1> with .
If an implicit value of type u.
The ConstantType
type is not directly written in user programs, but arises as the type of a constant.
The ConstantType
type is not directly written in user programs, but arises as the type of a constant.
The REPL expresses constant types like Int(11). Here are some constants with their types.
1 ConstantType(Constant(1)) "abc" ConstantType(Constant("abc"))
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 tree which defines a symbol-carrying entity.
An expression tree tagged with its type
Represents a free term captured by reification.
Represents a free term captured by reification.
Represents a free type captured by reification.
Represents a free type captured by reification.
Anonymous function, eliminated by analyzer
Common base class for Apply and TypeApply.
Identifier <name>
Conditional expression
A common base class for class and object definitions.
Import clause
Import selector
A labelled expression.
Literal
- Pattern matching expression (before explicitouter)
Common base class for all member definitions: types, classes, objects, packages, vals and vars, defs.
The MethodType
type signature is used to indicate parameters and result type of a method
The MethodType
type signature is used to indicate parameters and result type of a 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.
An object definition, e.
The abstract type of names
The abstract type of names
A tree with a name - effectively, a DefTree or RefTree.
Object instantiation One should always use factory method below to build a user level new.
A packaging, such as package pid { stats }
A tree which references a symbol-carrying entity.
Marks underlying reference to id as boxed.
The RefinedType
type defines types of any of the forms on the left,
with their RefinedType representations to the right.
The RefinedType
type defines types of any of the forms on the left,
with their RefinedType representations to the right.
P_1 with ... with P_m { D_1; ...; D_n} RefinedType(List(P_1, ..., P_m), Scope(D_1, ..., D_n)) P_1 with ... with P_m RefinedType(List(P_1, ..., P_m), Scope()) { D_1; ...; D_n} RefinedType(List(AnyRef), Scope(D_1, ..., D_n))
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
Designator <qualifier> .
Type selection <qualifier> # <name>, eliminated by RefCheck
The SingleType
type describes types of any of the forms on the left,
with their TypeRef representations to the right.
The SingleType
type describes types of any of the forms on the left,
with their TypeRef representations to the right.
(T # x).type SingleType(T, x) p.x.type SingleType(p.type, x) x.type SingleType(NoPrefix, x)
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.
The type of Scala singleton types, i.
The type of Scala singleton types, i.e. types that are inhabited by only one nun-null value. These include types of the forms
C.this.type C.super.type x.type
as well as constant types.
Singleton type, eliminated by RefCheck
Repetition of pattern, eliminated by explicitouter
Super reference, qual = corresponding this reference A super reference C.
The SuperType
type is not directly written, but arises when C.super
is used
as a prefix in a TypeRef
or SingleType
.
The SuperType
type is not directly written, but arises when C.super
is used
as a prefix in a TypeRef
or SingleType
. It's internal presentation is
SuperType(thistpe, supertpe)
Here, thistpe
is the type of the corresponding this-type. For instance,
in the type arising from C.super, the thistpe
part would be ThisType(C)
.
supertpe
is the type of the super class referred to by the super
.
An extractor class to create and pattern match with syntax SingleType(thistpe, supertpe)
A tree with a mutable symbol field, initialized to NoSymbol.
Instantiation template of a class or trait
The abstract type of names representing types
The abstract type of names representing types
A tree for a term.
Self reference
The ThisType
type describes types of the form on the left with the
correspnding ThisType representations to the right.
The ThisType
type describes types of the form on the left with the
correspnding ThisType representations to the right.
C.this.type ThisType(C)
An extractor class to create and pattern match with syntax ThisType(sym)
where sym
is the class prefix of the this type.
Throw expression
Tree is the basis for scala's abstract syntax.
A tree for a type.
The type of Scala types, and also Scala type signatures.
The type of Scala types, and also Scala type signatures. (No difference is internally made between the two).
Explicit type application.
The TypeBounds
type signature is used to indicate lower and upper type bounds
of type parameters and abstract types.
The TypeBounds
type signature is used to indicate lower and upper type bounds
of type parameters and abstract types. It is not a first-class type.
If an abstract type or type parameter is declared with any of the forms
on the left, its type signature is the TypeBounds type on the right.
T >: L <: U TypeBounds(L, U) T >: L TypeBounds(L, Any) T <: U TypeBounds(Nothing, U)
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 abstract type, a type parameter, or a type alias.
The abstract type of names representing terms
The abstract type of names representing terms
The TypeRef
type describes types of any of the forms on the left,
with their TypeRef representations to the right.
The TypeRef
type describes types of any of the forms on the left,
with their TypeRef representations to the right.
T # C[T_1, ..., T_n] TypeRef(T, C, List(T_1, ..., T_n)) p.C[T_1, ..., T_n] TypeRef(p.type, C, List(T_1, ..., T_n)) C[T_1, ..., T_n] TypeRef(NoPrefix, C, List(T_1, ..., T_n)) T # C TypeRef(T, C, Nil) p.C TypeRef(p.type, C, Nil) C TypeRef(NoPrefix, C, Nil)
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.
If an implicit value of type u.
A synthetic tree holding an arbitrary type.
Type annotation, eliminated by explicit outer
Broadly speaking, a value definition.
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 class symbol
the implementation template
The constructor/deconstructor for ClassInfoType
instances.
The constructor/deconstructor for ClassInfoType
instances.
The constructor/deconstructor for ConstantType
instances.
The constructor/deconstructor for ConstantType
instances.
The constructor/deconstructor for MethodType
instances.
The constructor/deconstructor for MethodType
instances.
the class symbol
the implementation template
0-1 argument list new, based on a type.
0-1 argument list new, based on a type.
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)
This constant is used as a special value denoting the empty prefix in a path dependent type.
This constant is used as a special value denoting the empty prefix in a path dependent type.
For instance x.type
is represented as SingleType(NoPrefix, <x>)
, where <x>
stands for
the symbol for x
.
This constant is used as a special value that indicates that no meaningful type exists.
This constant is used as a special value that indicates that no meaningful type exists.
The constructor/deconstructor for RefinedType
instances.
The constructor/deconstructor for RefinedType
instances.
The constructor/deconstructor for SingleType
instances.
The constructor/deconstructor for SingleType
instances.
The constructor/deconstructor for SuperType
instances.
The constructor/deconstructor for SuperType
instances.
The constructor/deconstructor for ThisType
instances.
The constructor/deconstructor for ThisType
instances.
The constructor/deconstructor for TypeBounds
instances.
The constructor/deconstructor for TypeBounds
instances.
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
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.
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.
A creator for type applications
A creator for type applications
Assigns a given position to all position-less nodes of a given AST.
Assigns a given position to all position-less nodes of a given AST.
An empty deferred value definition corresponding to:
val _: _
This is used as a placeholder in the self
parameter Template if there is
no definition of a self value of self type.
An empty deferred value definition corresponding to:
val _: _
This is used as a placeholder in the self
parameter Template if there is
no definition of a self value of self type.
Ensure that given tree has no positions that overlap with
any of the positions of others
.
Ensure that given tree has no positions that overlap with
any of the positions of others
. This is done by
shortening the range or assigning TransparentPositions
to some of the nodes in tree
.
A creator for existential types.
A creator for existential types. This generates:
tpe1 where { tparams }
where tpe1
is the result of extrapolating tpe
wrt to tparams
.
Extrapolating means that type variables in tparams
occurring
in covariant positions are replaced by upper bounds, (minus any
SingletonClass markers), type variables in tparams
occurring in
contravariant positions are replaced by upper bounds, provided the
resulting type is legal wrt to stability, and does not contain any type
variable in tparams
.
The abstraction drops all type parameters that are not directly or
indirectly referenced by type tpe1
. If there are no remaining type
parameters, simply returns result type tpe
.
Extracts free terms from a tree that is reified or contains reified subtrees.
Extracts free terms from a tree that is reified or contains reified subtrees.
Extracts free types from a tree that is reified or contains reified subtrees.
Extracts free types from a tree that is reified or contains reified subtrees.
The greatest lower bound wrt <:< of a list of types
The greatest lower bound wrt <:< of a list of types
A creator for intersection type where intersections of a single type are replaced by the type itself, and repeated parent classes are merged.
A creator for intersection type where intersections of a single type are replaced by the type itself, and repeated parent classes are merged.
!!! Repeated parent classes are not merged - is this a bug in the comment or in the code?
A creator for intersection type where intersections of a single type are replaced by the type itself.
A creator for intersection type where intersections of a single type are replaced by the type itself.
The least upper bound wrt <:< of a list of types
The least upper bound wrt <:< of a list of types
Creates a reporter that prints messages to the console according to the settings.
Creates a reporter that prints messages to the console according to the settings.
minSeverity determines minimum severity of the messages to be printed.
0 stands for INFO, 1 stands for WARNING and 2 stands for ERROR.
Create a Modiiers structure given internal flags, qualifier, annotations
Create a Modiiers structure given internal flags, qualifier, annotations
Create a fresh free existential type symbol.
Create a fresh free existential type symbol.
the name of the free variable
the type signature of the free variable
a type tag that captures the value of the free variable is completely phantom, since the captured type cannot be propagated to the runtime if it could be, we wouldn't be creating a free type to begin with the only usage for it is preserving the captured symbol for compile-time analysis
(optional) flags of the free variable
(optional) debug information that tells where this symbol comes from
Create a fresh free term symbol.
Create a fresh free term symbol.
the name of the free variable
the type signature of the free variable
the value of the free variable at runtime
(optional) flags of the free variable
debug information that tells where this symbol comes from
Create a fresh free non-existential type symbol.
Create a fresh free non-existential type symbol.
the name of the free variable
the type signature of the free variable
a type tag that captures the value of the free variable is completely phantom, since the captured type cannot be propagated to the runtime if it could be, we wouldn't be creating a free type to begin with the only usage for it is preserving the captured symbol for compile-time analysis
(optional) flags of the free variable
debug information that tells where this symbol comes from
Create a new scope nested in another one with which it shares its elements
Create a new scope nested in another one with which it shares its elements
Create a new scope
Create a new scope
Create a new scope with given initial elements
Create a new scope with given initial elements
Create a new term name.
Create a new term name.
Hook to define what show(tree)
means.
Hook to define what show(tree)
means.
Creates a new type name.
Creates a new type name.
A creator for type parameterizations that strips empty type parameter lists.
A creator for type parameterizations that strips empty type parameter lists. Use this factory method to indicate the type has kind * (it's a polymorphic value) until we start tracking explicit kinds equivalent to typeFun (except that the latter requires tparams nonEmpty).
The canonical creator for a refined type with an initially empty scope.
The canonical creator for a refined type with an initially empty scope.
...
...
...
the canonical creator for a refined type with a given scope
the canonical creator for a refined type with a given scope
Selects overloaded method symbol with given name and index
Unlike selectOverloadedMethodIfDefined
, throws MissingRequirementError
is requested overloaded method cannot be found.
Selects overloaded method symbol with given name and index
Unlike selectOverloadedMethodIfDefined
, throws MissingRequirementError
is requested overloaded method cannot be found.
Selects overloaded method symbol with given name and index
Unlike selectOverloadedMethod
, doesn't throw MissingRequirementError
(returns NoSymbol) is requested overloaded method cannot be found.
Selects overloaded method symbol with given name and index
Unlike selectOverloadedMethod
, doesn't throw MissingRequirementError
(returns NoSymbol) is requested overloaded method cannot be found.
Selects term symbol with given name and type from the defined members of prefix type
Unlike selectTermIfDefined
, throws MissingRequirementError
is requested term symbol cannot be found.
Selects term symbol with given name and type from the defined members of prefix type
Unlike selectTermIfDefined
, throws MissingRequirementError
is requested term symbol cannot be found.
Selects term symbol with given name and type from the defined members of prefix type
Unlike selectTerm
, doesn't throw MissingRequirementError
(returns NoSymbol) is requested term symbol cannot be found.
Selects term symbol with given name and type from the defined members of prefix type
Unlike selectTerm
, doesn't throw MissingRequirementError
(returns NoSymbol) is requested term symbol cannot be found.
Selects type symbol with given simple name name
from the defined members of owner
.
Selects type symbol with given simple name name
from the defined members of owner
.
Unlike selectTypeIfDefined
, throws MissingRequirementError
is requested type symbol cannot be found.
Selects type symbol with given simple name name
from the defined members of owner
.
Selects type symbol with given simple name name
from the defined members of owner
.
Unlike selectType
, doesn't throw MissingRequirementError
(returns NoSymbol) is requested type symbol cannot be found.
The canonical creator for single-types
The canonical creator for single-types
The symbol corresponding to the globally accessible class with the given fully qualified name fullName
.
The symbol corresponding to the globally accessible class with the given fully qualified name fullName
.
Unlike staticClassIfDefined
, throws MissingRequirementError
is requested class cannot be found.
The symbol corresponding to the globally accessible class with the given fully qualified name fullName
.
The symbol corresponding to the globally accessible class with the given fully qualified name fullName
.
Unlike staticClass
, doesn't throw MissingRequirementError
(returns NoSymbol) is requested class cannot be found.
The symbol corresponding to the globally accessible object with the given fully qualified name fullName
.
The symbol corresponding to the globally accessible object with the given fully qualified name fullName
.
Unlike staticModuleIfDefined
, throws MissingRequirementError
is requested object cannot be found.
The symbol corresponding to the globally accessible object with the given fully qualified name fullName
.
The symbol corresponding to the globally accessible object with the given fully qualified name fullName
.
Unlike staticModule
, doesn't throw MissingRequirementError
(returns NoSymbol) is requested object cannot be found.
Substitutes free types in a reified type.
Substitutes free types in a reified type.
Substitutes free types in a reified tree.
Substitutes free types in a reified tree.
The this-ptype of the globally accessible object with the
given fully qualified name fullName
.
The this-ptype of the globally accessible object with the
given fully qualified name fullName
.
The canonical creator for typerefs
The canonical creator for typerefs
A position that wraps the non-empty set of trees.
A position that wraps the non-empty set of trees. The point of the wrapping position is the point of the first trees' position. If all some the trees are non-synthetic, returns a range position enclosing the non-synthetic trees Otherwise returns a synthetic offset position to point.
A position that wraps a set of trees.
A position that wraps a set of trees. The point of the wrapping position is the point of the default position. If some of the trees are ranges, returns a range position enclosing all ranges Otherwise returns default position.
Test two objects for inequality.
Test two objects for inequality.
true
if !(this == that), false otherwise.
Equivalent to x.hashCode
except for boxed numeric types and null
.
Equivalent to x.hashCode
except for boxed numeric types and null
.
For numerics, it returns a hash value which is consistent
with value equality: if two value type instances compare
as true, then ## will produce the same hash value for each
of them.
For null
returns a hashcode where null.hashCode
throws a
NullPointerException
.
a hash value consistent with ==
Test two objects for equality.
Test two objects for equality.
The expression x == that
is equivalent to if (x eq null) that eq null else x.equals(that)
.
true
if the receiver object is equivalent to the argument; false
otherwise.
The empty tree
Cast the receiver object to be of type T0
.
Cast the receiver object to be of type T0
.
Note that the success of a cast at runtime is modulo Scala's erasure semantics.
Therefore the expression 1.asInstanceOf[String]
will throw a ClassCastException
at
runtime, while the expression List(1).asInstanceOf[List[String]]
will not.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the requested type.
the receiver object.
if the receiver object is not an instance of the erasure of type T0
.
Create a copy of the receiver object.
Tests whether the argument (arg0
) is a reference to the receiver object (this
).
Tests whether the argument (arg0
) is a reference to the receiver object (this
).
The eq
method implements an equivalence relation on
non-null instances of AnyRef
, and has three additional properties:
x
and y
of type AnyRef
, multiple invocations of
x.eq(y)
consistently returns true
or consistently returns false
.x
of type AnyRef
, x.eq(null)
and null.eq(x)
returns false
.null.eq(null)
returns true
. When overriding the equals
or hashCode
methods, it is important to ensure that their behavior is
consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2
), they
should be equal to each other (o1 == o2
) and they should hash to the same value (o1.hashCode == o2.hashCode
).
true
if the argument is a reference to the receiver object; false
otherwise.
The equality method for reference types.
Called by the garbage collector on the receiver object when there are no more references to the object.
Called by the garbage collector on the receiver object when there are no more references to the object.
The details of when and if the finalize
method is invoked, as
well as the interaction between finalize
and non-local returns
and exceptions, are all platform dependent.
Returns string formatted according to given format
string.
Returns string formatted according to given format
string.
Format strings are as for String.format
(@see java.lang.String.format).
A representation that corresponds to the dynamic class of the receiver object.
A representation that corresponds to the dynamic class of the receiver object.
The nature of the representation is platform dependent.
a representation that corresponds to the dynamic class of the receiver object.
not specified by SLS as a member of AnyRef
The hashCode method for reference types.
Test whether the dynamic type of the receiver object is T0
.
Test whether the dynamic type of the receiver object is T0
.
Note that the result of the test is modulo Scala's erasure semantics.
Therefore the expression 1.isInstanceOf[String]
will return false
, while the
expression List(1).isInstanceOf[List[String]]
will return true
.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the specified type.
true
if the receiver object is an instance of erasure of type T0
; false
otherwise.
Creates a UI-less reporter that simply accumulates all the messages
Creates a UI-less reporter that simply accumulates all the messages
Equivalent to !(this eq that)
.
Equivalent to !(this eq that)
.
true
if the argument is not a reference to the receiver object; false
otherwise.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up a single thread that is waiting on the receiver object's monitor.
not specified by SLS as a member of AnyRef
Wakes up all threads that are waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
not specified by SLS as a member of AnyRef
Given an expression, generate a tree that when compiled and executed produces the original tree.
Given an expression, generate a tree that when compiled and executed produces the original tree. The produced tree will be bound to the Universe it was called from.
For instance, given the abstract syntax tree representation of the <[ x + 1 ]> expression:
Apply(Select(Ident("x"), "+"), List(Literal(Constant(1))))
The reifier transforms it to the following expression:
<[ val $mr: scala.reflect.api.Universe = <reference to the Universe that calls the reify> $mr.Expr[Int]($mr.Apply($mr.Select($mr.Ident($mr.newFreeVar("x", <Int>, x), "+"), List($mr.Literal($mr.Constant(1)))))) ]>
Reification performs expression splicing (when processing Expr.eval and Expr.value) and type splicing (for every type T that has a TypeTag[T] implicit in scope):
val two = mirror.reify(2) // Literal(Constant(2)) val four = mirror.reify(two.eval + two.eval) // Apply(Select(two.tree, newTermName("$plus")), List(two.tree))
def macroImpl[T](c: Context) = { ... // T here is just a type parameter, so the tree produced by reify won't be of much use in a macro expansion // however, if T were annotated with c.TypeTag (which would declare an implicit parameter for macroImpl) // then reification would subtitute T with the TypeTree that was used in a TypeApply of this particular macro invocation val factory = c.reify{ new Queryable[T] } ... }
The transformation looks mostly straightforward, but it has its tricky parts: * Reifier retains symbols and types defined outside the reified tree, however locally defined entities get erased and replaced with their original trees * Free variables are detected and wrapped in symbols of the type FreeVar * Mutable variables that are accessed from a local function are wrapped in refs * Since reified trees can be compiled outside of the scope they've been created in, special measures are taken to ensure that all members accessed in the reifee remain visible
Creates a String representation of this object.
Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.
a String representation of the object.
(Since version 2.10.0) Use leftOfArrow instead
(Since version 2.10.0) Use resultOfEnsuring instead