A version of Typer that keeps all symbols defined and referenced in a previously typed tree.
All definition nodes keep their symbols. All leaf nodes for idents, selects, and TypeTrees keep their types. Indexing is a no-op.
Otherwise, everything is as in Typer.
Check that equality tests between types
rtp make sense
tree == x: pt is typeable. Used when checking a pattern
against a selector of type
pt. This implementation accounts for
user-defined definitions of
Overwritten to no-op in ReTyper.
If this is a real class, make sure its first parent is a constructor call. Cannot simply use a type. Overridden in ReTyper.
Overridden in ReTyper to handle primitive operations that can be generated after erasure
Create top-level symbols for statements and enter them into symbol table
Find an implicit conversion to apply to given tree
from so that the
result is compatible with type
Given an inline method
mdef, the method rewritten so that its body
uses accessors to access non-public members.
Overwritten in Retyper to return
Does the "contextuality" of the method type
methType match the one of the prototype
This is the case if
- both are contextual, or
- neither is contextual, or
- the prototype is contextual and the method type is implicit.
The last rule is there for a transition period; it allows to mix
with old-style implicit functions.
ReTyper, where all applications are treated the same
Checks that the given tree has been typed
Retrieve symbol attached to given tree
The symbol of the given expanded tree.
Potentially add apply node or implicit conversions. Before trying either, if the function is applied to an empty parameter list (), we try
0th strategy: If
tree overrides a nullary method, mark the prototype
so that the argument is dropped and return
(but do this at most once per tree).
After that, two strategies are tried, and the first that is successful is picked.
1st strategy: Try to insert
.apply so that the result conforms to prototype
This strategy is not tried if the prototype represents already
2nd strategy: If tree is a select
qual.name, try to insert an implicit conversion
around the qualifier part
qual so that the result conforms to the expected type
with wildcard result type.
If neither of the strategies are successful, continues with the
if an apply insertion was tried and
tree has an
apply method, or continues
fallBack is supposed to always give an error.
Attribute an identifier consisting of a simple name or wildcard
A typed unapply hook, can be overridden by re any-typers between frontend and pattern matcher.