Namer
This class creates symbols from definitions and imports and gives them lazy types.
Timeline:
During enter, trees are expanded as necessary, populating the expandedTree map. Symbols are created, and the symOfTree map is set up.
Symbol completion causes some trees to be already typechecked and typedTree entries are created to associate the typed trees with the untyped expanded originals.
During typer, original trees are first expanded using expandedTree. For each expanded member definition or import we extract and remove the corresponding symbol from the symOfTree map and complete it. We then consult the typedTree map to see whether a typed tree exists already. If yes, the typed tree is returned as result. Otherwise, we proceed with regular type checking.
The scheme is designed to allow sharing of nodes, as long as each duplicate appears in a different method.
Attributes
- Graph
-
- Supertypes
- Known subtypes
- Self type
Members list
Type members
Classlikes
Attributes
- Supertypes
-
class Completertrait SecondCompleterclass LazyTypeclass UncachedGroundTypeclass Typetrait Showabletrait Hashableclass Objecttrait Matchableclass AnyShow all
The completer of a symbol defined by a member def or import (except ClassSymbols)
The completer of a symbol defined by a member def or import (except ClassSymbols)
Attributes
- Supertypes
-
trait SecondCompleterclass LazyTypeclass UncachedGroundTypeclass Typetrait Showabletrait Hashableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class ClassCompleterclass TypeDefCompleter
Attributes
- Supertypes
-
trait SecondCompleterclass LazyTypeclass UncachedGroundTypeclass Typetrait Showabletrait Hashableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait TypeParamsCompleterclass Completertrait SecondCompleterclass LazyTypeclass UncachedGroundTypeclass Typetrait Showabletrait Hashableclass Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Add child annotation for child
to annotations of cls
. The annotation is added at the correct insertion point, so that Child annotations appear in reverse order of their start positions.
Add child annotation for child
to annotations of cls
. The annotation is added at the correct insertion point, so that Child annotations appear in reverse order of their start positions.
Attributes
Add java enum constants
Add java enum constants
Attributes
Check that a new definition with given name and privacy status in current context would not conflict with existing currently compiled definitions. The logic here is very subtle and fragile due to the fact that we are not allowed to force anything.
Check that a new definition with given name and privacy status in current context would not conflict with existing currently compiled definitions. The logic here is very subtle and fragile due to the fact that we are not allowed to force anything.
Attributes
Enter and typecheck parameter list
Enter and typecheck parameter list
Attributes
If this tree is a member def or an import, create a symbol of it and store in symOfTree map.
If this tree is a member def or an import, create a symbol of it and store in symOfTree map.
Attributes
The type signature of a DefDef with given symbol
The type signature of a DefDef with given symbol
Attributes
The enclosing class with given name; error if none exists
The enclosing class with given name; error if none exists
Attributes
Ensure that the first type in a list of parent types Ps points to a non-trait class. If that's not already the case, add one. The added class type CT is determined as follows. First, let C be the unique class such that
Ensure that the first type in a list of parent types Ps points to a non-trait class. If that's not already the case, add one. The added class type CT is determined as follows. First, let C be the unique class such that
- there is a parent P_i such that P_i derives from C, and
- for every class D: If some parent P_j, j <= i derives from D, then C derives from D. Then, let CT be the smallest type which
- has C as its class symbol, and
- for all parents P_i: If P_i derives from C then P_i <:< CT.
Tweak: It could be that at the point where the method is called, some superclass is still missing its parents. Parents are set to Nil when completion starts and are set to the actual parents later. If a superclass completes a subclass in one of its parents, the parents of the superclass or some intervening class might not yet be set. This situation can be detected by asking for the baseType of Any - if that type does not exist, one of the base classes of this class misses its parents. If this situation arises, the computation of the superclass might be imprecise. For instance, in i12722.scala, the superclass of IPersonalCoinOps
is computed as Object
, where JsObject
would be correct. The problem cannot be solved locally, but we detect the situaton and mark the superclass with a @ProvisionalSuperClass
annotation in this case. When typechecking the class, we then run ensureFirstIsClass again and possibly improve the computed super class. An alternatiev fix would compute superclasses at typer instead at completion. But that breaks too many invariants. For instance, we rely on correct @Child annotations after completion, and these in turn need the superclass.
Attributes
If sym
exists, enter it in effective scope. Check that package members are not entered twice in the same run.
If sym
exists, enter it in effective scope. Check that package members are not entered twice in the same run.
Attributes
Expand tree and store in expandedTree
Expand tree and store in expandedTree
Attributes
The expanded version of this tree, or tree itself if not expanded
The expanded version of this tree, or tree itself if not expanded
Attributes
The type bound on wildcard imports of an import list, with special values Nothing if no wildcard imports of this kind exist Any if there are unbounded wildcard imports of this kind
The type bound on wildcard imports of an import list, with special values Nothing if no wildcard imports of this kind exist Any if there are unbounded wildcard imports of this kind
Attributes
Expand tree and create top-level symbols for statement and enter them into symbol table
Expand tree and create top-level symbols for statement and enter them into symbol table
Attributes
Create top-level symbols for statements and enter them into symbol table
Create top-level symbols for statements and enter them into symbol table
Attributes
- Returns
-
A context that reflects all imports in
stats
.
Create top-level symbols for all statements in the expansion of this statement and enter them into symbol table
Create top-level symbols for all statements in the expansion of this statement and enter them into symbol table
Attributes
For all class definitions stat
in xstats
: If the companion class is not also defined in xstats
, invalidate it by setting its info to NoType.
For all class definitions stat
in xstats
: If the companion class is not also defined in xstats
, invalidate it by setting its info to NoType.
Attributes
Determines whether this field holds an enum constant.
Determines whether this field holds an enum constant.
Attributes
Parse the source and index symbols in the compilation unit's untpdTree while asserting the lateCompile
flag. This will cause any old top-level symbol with the same fully qualified name as a newly created symbol to be replaced.
Parse the source and index symbols in the compilation unit's untpdTree while asserting the lateCompile
flag. This will cause any old top-level symbol with the same fully qualified name as a newly created symbol to be replaced.
Will call the callback with an implementation of type checking That will set the tpdTree and root tree for the compilation unit.
Attributes
The signature of a module valdef. This will compute the corresponding module class TypeRef immediately without going through the defined type of the ValDef. This is necessary to avoid cyclic references involving imports and module val defs.
The signature of a module valdef. This will compute the corresponding module class TypeRef immediately without going through the defined type of the ValDef. This is necessary to avoid cyclic references involving imports and module val defs.
Attributes
Prepare a GADT-aware context used to type the RHS of a ValOrDefDef.
Prepare a GADT-aware context used to type the RHS of a ValOrDefDef.
Attributes
Record sym
as the symbol defined by tree
Record sym
as the symbol defined by tree
Attributes
The symbol of the given expanded tree.
The symbol of the given expanded tree.
Attributes
Typecheck tree
during completion using typed
, and remember result in TypedAhead map
Typecheck tree
during completion using typed
, and remember result in TypedAhead map
Attributes
The type signature of a ValDef or DefDef
The type signature of a ValDef or DefDef
Value parameters
- mdef
-
The definition
- paramFn
-
A wrapping function that produces the type of the defined symbol, given its final return type
- sym
-
Its symbol
Attributes
Concrete fields
A map from method symbols to nested typers. Populated when methods are completed. Emptied when they are typechecked. The nested typer contains new versions of the four maps above including this one, so that trees that are shared between different DefDefs can be independently used as indices. It also contains a scope that contains nested parameters.
A map from method symbols to nested typers. Populated when methods are completed. Emptied when they are typechecked. The nested typer contains new versions of the four maps above including this one, so that trees that are shared between different DefDefs can be independently used as indices. It also contains a scope that contains nested parameters.