Dotty Documentation

0.5.0-bin-SNAPSHOT

class ReTyper
extends Typer

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.

[-] Constructors

ReTyper ( )

[-] Members

[+] override def annotate ( trees: List [ Tree ] ) ( implicit ctx: Context ) : Unit
[+] override def checkCanEqual ( ltp: Type , rtp: Type , pos: Position ) ( implicit ctx: Context ) : Unit

Check that equality tests between types ltp and rtp make sense

[+] protected override def checkEqualityEvidence ( tree: Tree , pt: Type ) ( implicit ctx: Context ) : Unit

Check that 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.

[+] override def checkVariance ( tree: Tree ) ( implicit ctx: Context ) : Unit

Overridden in retyper

[+] override def completeAnnotations ( mdef: MemberDef , sym: Symbol ) ( implicit ctx: Context ) : Unit
[+] override def ensureConstrCall ( cls: ClassSymbol , parents: List [ Tree ] ) ( implicit ctx: Context ) : List [ Tree ]

If this is a real class, make sure its first parent is a constructor call. Cannot simply use a type. Overridden in ReTyper.

[+] override def handleUnexpectedFunType ( tree: Apply , fun: Tree ) ( implicit ctx: Context ) : Tree

Overridden in ReTyper to handle primitive operations that can be generated after erasure

[+] override def index ( trees: List [ Tree ] ) ( implicit ctx: Context ) : Context

Create top-level symbols for statements and enter them into symbol table

[+] override def inferView ( from: Tree , to: Type ) ( implicit ctx: Context ) : SearchResult

Find an implicit conversion to apply to given tree from so that the result is compatible with type to.

[+] override def inlineExpansion ( mdef: DefDef ) ( implicit ctx: Context ) : List [ Tree ]

Given an inline method mdef, the method rewritten so that its body uses accessors to access non-public members, followed by the accessor definitions. Overwritten in Retyper to return mdef unchanged.

[+] override def localDummy ( cls: ClassSymbol , impl: Template ) ( implicit ctx: Context ) : Symbol
[+] override def localTyper ( sym: Symbol ) : Typer
[+] protected def promote ( tree: Tree ) ( implicit ctx: Context ) : ThisTree [ Type ]

Checks that the given tree has been typed

[+] override def retrieveSym ( tree: Tree ) ( implicit ctx: Context ) : Symbol

Retrieve symbol attached to given tree

[+] override def symbolOfTree ( tree: Tree ) ( implicit ctx: Context ) : Symbol

The symbol of the given expanded tree.

[+] override def tryInsertApplyOrImplicit ( tree: Tree , pt: ProtoType ) ( fallBack: => Tree ) ( implicit ctx: Context ) : 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 tree itself.

After that, two strategies are tried, and the first that is successful is picked. If neither of the strategies are successful, continues withfallBack.

1st strategy: Try to insert .apply so that the result conforms to prototype pt. This strategy is not tried if the prototype represents already another .apply or .apply() selection.

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.

[+] override def typedBind ( tree: Bind , pt: Type ) ( implicit ctx: Context ) : Bind
[+] override def typedIdent ( tree: Ident , pt: Type ) ( implicit ctx: Context ) : Tree

Attribute an identifier consisting of a simple name or wildcard

[+] override def typedLiteral ( tree: Literal ) ( implicit ctc: Context ) : Literal
[+] override def typedSelect ( tree: Select , pt: Type ) ( implicit ctx: Context ) : Tree
[+] override def typedSuper ( tree: Super , pt: Type ) ( implicit ctx: Context ) : Tree
[+] override def typedThis ( tree: This ) ( implicit ctx: Context ) : Tree
[+] override def typedTypeTree ( tree: TypeTree , pt: Type ) ( implicit ctx: Context ) : TypeTree
[+] override def typedUnApply ( tree: UnApply , selType: Type ) ( implicit ctx: Context ) : UnApply

A typed unapply hook, can be overridden by re any-typers between frontend and pattern matcher.

[+] override def typedUnadapted ( tree: Tree , pt: Type ) ( implicit ctx: Context ) : Tree