Dotty Documentation

0.6.0-bin-SNAPSHOT

trait Applications
extends Object with 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 compare ( alt1: TermRef , alt2: TermRef , nesting1: Int , nesting2: Int ) ( implicit ctx: Context ) : Int

Compare to alternatives of an overloaded call or an implicit search.

[+] def compareOwner ( sym1: Symbol , sym2: Symbol ) ( implicit ctx: Context ) : Int

Compare owner inheritance level.

[+] 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 harmonic ( harmonize: List [ T ] => List [ T ] ) ( op: => List [ T ] ) ( implicit ctx: Context ) : List [ T ]

Apply a transformation harmonize on the results of operation op. If the result is different (wrt eq) from the original results of op, revert back to the constraint in force before computing op. This reset is needed because otherwise the original results might have added constraints to type parameters which are no longer implied after harmonization. No essential constraints are lost by this because the result of harmomization will be compared again with the expected type. Test cases where this matters are in pos/harmomize.scala.

[+] 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 constant trees to this type. If the resulting trees all have the same type, return them instead of the original ones.

[+] private 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 widen any constant types in tpes to it. If the resulting types are all the same, return them instead of the original ones.

[+] 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 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. If the formal parameter types corresponding to a closure argument all agree on their argument types, typecheck the argument with an expected function or partial function type that contains these argument types, 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 Char => ? as the expected type of the closure x => x.toUpper, which makes the code typecheck.

[+] 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. Two trials: First, without implicits or SAM conversions enabled. Then, if the fist finds no eligible candidates, with implicits and SAM conversions enabled.

[+] 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 and SAM conversions 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.