Dotty Documentation

0.1.1-bin-SNAPSHOT

trait Applications
extends Compatibility

[-] Constructors

[-] Members

[+] class ApplicableToTrees

Subclass of Application for applicability tests with type arguments and value argument trees.

Subclass of Application for applicability tests with type arguments and value argument trees.

[+] class ApplicableToTypes

Subclass of Application for applicability tests with value argument types.

[+] abstract class Application
[+] class ApplyToTyped

Subclass of Application for type checking an Apply node with typed arguments.

[+] class ApplyToUntyped

Subclass of Application for type checking an Apply node with untyped arguments.

[+] abstract class TestApplication

Subclass of Application for the cases where we are interested only in a "can/cannot apply" answer, without needing to construct trees or issue error messages.

[+] abstract class TypedApply

Subclass of Application for type checking an Apply node, where types of arguments are either known or unknown.

[+] def argCtx ( app: Tree ) ( implicit ctx: Context ) : Context

If app is a this(...) constructor call, the this-call argument context, otherwise the current context.

[+] def convertNewGenericArray ( tree: Tree ) ( implicit ctx: Context ) : Tree

Rewrite new Array[T](....) if T is an unbounded generic to calls to newGenericArray. It is performed during typer as creation of generic arrays needs a classTag. we rely on implicit search to find one.

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

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

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

If trees all have numeric value types, and they do not have all the same type, pick a common numeric supertype and convert all trees to this type.

[+] def harmonizeTypes ( tpes: List [ Type ] ) ( implicit ctx: Context ) : List [ Type ]

If all types are numeric value types, and they are not all the same type, pick a common numeric supertype and return it instead of every original type.

[+] private def harmonizeWith ( ts: List [ T ] ) ( tpe: T => Type , adapt: (T, Type) => T ) ( implicit ctx: Context ) : List [ T ]
[+] def isApplicable ( methRef: TermRef , targs: List [ Type ] , args: List [ Tree ] , resultType: Type ) ( implicit ctx: Context ) : Boolean

Is given method reference applicable to type arguments targs and argument trees args?

[+] def isApplicable ( methRef: TermRef , args: List [ Type ] , resultType: Type ) ( implicit ctx: Context ) : Boolean

Is given method reference applicable to argument types args?

[+] def isApplicable ( tp: Type , targs: List [ Type ] , args: List [ Tree ] , resultType: Type ) ( implicit ctx: Context ) : Boolean

Is given type applicable to type arguments targs and argument trees args, possibly after inserting an apply?

[+] def isApplicable ( tp: Type , args: List [ Type ] , resultType: Type ) ( implicit ctx: Context ) : Boolean

Is given type applicable to argument types args, possibly after inserting an apply?

[+] def isAsGood ( alt1: TermRef , alt2: TermRef , nesting1: Int , nesting2: Int ) ( implicit ctx: Context ) : Boolean

In a set of overloaded applicable alternatives, is alt1 at least as good as alt2? Also used for implicits disambiguation.

[+] def isDirectlyApplicable ( methRef: TermRef , targs: List [ Type ] , args: List [ Tree ] , resultType: Type ) ( implicit ctx: Context ) : Boolean

Is given method reference applicable to type arguments targs and argument trees args without inferring views?

[+] def narrowMostSpecific ( alts: List [ TermRef ] ) ( implicit ctx: Context ) : List [ TermRef ]
[+] private def onMethod ( tp: Type , p: TermRef => Boolean ) ( implicit ctx: Context ) : Boolean
[+] private def pretypeArgs ( alts: List [ TermRef ] , pt: FunProto ) ( implicit ctx: Context ) : Unit

Try to typecheck any arguments in pt that are function values missing a parameter type. The expected type for these arguments is the lub of the corresponding formal parameter types of all alternatives. Type variables in formal parameter types are replaced by wildcards. The result of the typecheck is stored in pt, to be retrieved when its typedArgs are selected. The benefit of doing this is to allow idioms like this:

def map(f: Char => Char): String = ??? def map[U](f: Char => U): Seq[U] = ??? map(x => x.toUpper)

Without pretypeArgs we'd get a "missing parameter type" error for x. With pretypeArgs, we use the union of the two formal parameter types Char => Char and Char => ? as the expected type of the closure x => x.toUpper. That union is Char => Char, so we have an expected parameter type Char for x, and the code typechecks.

[+] def resolveOverloaded ( alts: List [ TermRef ] , pt: Type ) ( implicit ctx: Context ) : List [ TermRef ]

Resolve overloaded alternative alts, given expected type pt and possibly also type argument targs that need to be applied to each alternative to form the method type. todo: use techniques like for implicits to pick candidates quickly?

[+] private def resolveOverloaded ( alts: List [ TermRef ] , pt: Type , targs: List [ Type ] ) ( implicit ctx: Context ) : List [ TermRef ]

This private version of resolveOverloaded does the bulk of the work of overloading resolution, but does not do result adaptation. It might be called twice from the public resolveOverloaded method, once with implicits enabled, and once without.

[+] def typedApply ( tree: Apply , pt: Type ) ( implicit ctx: Context ) : Tree
[+] def typedNamedArgs ( args: List [ Tree ] ) ( implicit ctx: Context ) : List [ NamedArg [ Type ] ]
[+] def typedTypeApply ( tree: TypeApply , pt: Type ) ( implicit ctx: Context ) : Tree
[+] def typedUnApply ( tree: Apply , selType: Type ) ( implicit ctx: Context ) : Tree
[+] 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.