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.
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.
Subclass of Application for applicability tests with value argument types.
Subclass of Application for applicability tests with value argument types.
the type of arguments, could be tpd.Tree, untpd.Tree, or Type
Subclass of Application for type checking an Apply node with typed arguments.
Subclass of Application for type checking an Apply node with typed arguments.
Subclass of Application for type checking an Apply node with untyped arguments.
Subclass of Application for type checking an Apply node with untyped arguments.
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)
An implicit search; parameters as in inferImplicit
An implicit search; parameters as in inferImplicit
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.
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.
Subclass of Application for type checking an Apply node, where types of arguments are either known or unknown.
Subclass of Application for type checking an Apply node, where types of arguments are either known or unknown.
The selection type, which is additionally checked for accessibility.
The selection type, which is additionally checked for accessibility.
Perform the following adaptations of expression, pattern or type tree
wrt to
given prototype pt
:
(1) Resolve overloading
(2) Apply parameterless functions
(3) Apply polymorphic types to fresh instances of their type parameters and
store these instances in context.undetparams,
unless followed by explicit type application.
Perform the following adaptations of expression, pattern or type tree
wrt to
given prototype pt
:
(1) Resolve overloading
(2) Apply parameterless functions
(3) Apply polymorphic types to fresh instances of their type parameters and
store these instances in context.undetparams,
unless followed by explicit type application.
(4) Do the following to unapplied methods used as values:
(4.1) If the method has only implicit parameters pass implicit arguments
(4.2) otherwise, if pt
is a function type and method is not a constructor,
convert to function by eta-expansion,
(4.3) otherwise, if the method is nullary with a result type compatible to pt
and it is not a constructor, apply it to ()
otherwise issue an error
(5) Convert constructors in a pattern as follows:
(5.1) If constructor refers to a case class factory, set tree's type to the unique
instance of its primary constructor that is a subtype of the expected type.
(5.2) If constructor refers to an extractor, convert to application of
unapply or unapplySeq method.
(6) Convert all other types to TypeTree nodes. (7) When in TYPEmode but not FUNmode or HKmode, check that types are fully parameterized (7.1) In HKmode, higher-kinded types are allowed, but they must have the expected kind-arity (8) When in both EXPRmode and FUNmode, add apply method calls to values of object type. (9) If there are undetermined type variables and not POLYmode, infer expression instance Then, if tree's type is not a subtype of expected type, try the following adaptations: (10) If the expected type is Byte, Short or Char, and the expression is an integer fitting in the range of that type, convert it to that type. (11) Widen numeric literals to their expected type, if necessary (12) When in mode EXPRmode, convert E to { E; () } if expected type is scala.Unit. (13) When in mode EXPRmode, apply AnnotationChecker conversion if expected type is annotated. (14) When in mode EXPRmode, apply a view If all this fails, error
Add java enum constants
Add java enum constants
If app
is a this(...)
constructor call, the this-call argument context,
otherwise the current context.
If app
is a this(...)
constructor call, the this-call argument context,
otherwise the current context.
assert Java classes are not used as objects
Type assignment method.
Type assignment method. Each method takes as parameters
An upper approximation of the given type tp
that does not refer to any symbol in symsToAvoid
.
An upper approximation of the given type tp
that does not refer to any symbol in symsToAvoid
.
Approximation steps are:
Check that equality tests between types ltp
and rtp
make sense
Check that tp
is a class type.
Check that tp
is a class type.
Also, if traitReq
is true, check that tp
is a trait.
Also, if stablePrefixReq
is true and phase is not after RefChecks,
check that class prefix is stable.
tp
itself if it is a class or trait ref, ObjectType if not.
Check that any top-level type arguments in this type are feasible, i.e.
Check that any top-level type arguments in this type are feasible, i.e. that their lower bound conforms to their upper bound. If a type argument is infeasible, issue and error and continue with upper bound.
check Java classes are not used as objects
Check that a non-implicit parameter making up the first parameter section of an implicit conversion is not a singleton type.
Check that a non-implicit parameter making up the first parameter section of an implicit conversion is not a singleton type.
Check that tree
is a pure expression of constant type
Check that tree
is a pure expression of constant type
Check that class does not define same symbol twice
Check that class does not define same symbol twice
Check that PolyParams and MethodParams refer to an enclosing type
Check that tpt
does not refer to a singleton type
Check that tpt
does not refer to a singleton type
Check that all type members of tp
have realizable bounds
Check that all type members of tp
have realizable bounds
Check that tpt
does not define a higher-kinded type
Check that tpt
does not define a higher-kinded type
Check that type tp
is stable.
Check that type tp
is stable.
Check that Java statics and packages can only be used in selections.
Check that Java statics and packages can only be used in selections.
Overridden in retyper
Enter and typecheck parameter list
Enter and typecheck parameter list
Check that the result type of the current method fits the given expected result type.
Check that the result type of the current method fits the given expected result type.
Rewrite new Array[T](....)
if T is an unbounded generic to calls to newGenericArray.
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.
The Docstrings typer will handle the expansion of @define
and
<invalid inheritdoc annotation>
if there is a DocContext
present as a property in the
supplied ctx
.
The Docstrings typer will handle the expansion of @define
and
<invalid inheritdoc annotation>
if there is a DocContext
present as a property in the
supplied ctx
.
It will also type any @usecase
available in function definitions.
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.
The type signature of a DefDef with given symbol
The type signature of a DefDef with given symbol
The enclosing class with given name; error if none exists
The enclosing class with given name; error if none exists
If tpe
is a named type, check that its denotation is accessible in the
current context.
If tpe
is a named type, check that its denotation is accessible in the
current context. Return the type with those alternatives as denotations
which are accessible.
Also performs the following normalizations on the type tpe
.
(1) parameter accessors are always dereferenced.
(2) if the owner of the denotation is a package object, it is assured
that the package object shows up as the prefix.
If this is a real class, make sure its first parent is a constructor call.
Ensure that first parent tree refers to a real class.
Ensure that first parent tree refers to a real class.
Ensure that the first type in a list of parent types Ps points to a non-trait class.
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
Check that expression's type can be expressed without references to locally defined symbols.
Check that expression's type can be expressed without references to locally defined symbols. The following two remedies are tried before giving up:
If sym
exists, enter it in effective scope.
If sym
exists, enter it in effective scope. Check that
package members are not entered twice in the same run.
Expand tree and store in expandedTree
Expand tree and store in expandedTree
The expanded version of this tree, or tree itself if not expanded
The expanded version of this tree, or tree itself if not expanded
Overridden in ReTyper to handle primitive operations that can be generated after erasure
Overridden in ReTyper to handle primitive operations that can be generated after erasure
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.
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.
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.
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.
A new context that summarizes an import statement
A new context that summarizes an import statement
A new context for the interior of a class
A new context for the interior of a class
Create top-level symbols for statements and enter them into symbol table
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
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
Find an implicit parameter or conversion.
Find an implicit parameter or conversion.
The expected type of the parameter or conversion.
If an implicit conversion is searched, the argument to which it should be applied, EmptyTree otherwise.
The position where errors should be reported. !!! todo: catch potential cycles
Find an implicit argument for parameter formal
.
Find an implicit argument for parameter formal
.
An error handler that gets an error message parameter which is itself parameterized by another string, indicating where the implicit parameter is needed
Find an implicit conversion to apply to given tree from
so that the
result is compatible with type to
.
Given an inline method mdef
, the method rewritten so that its body
uses accessors to access non-public members, followed by the accessor definitions.
For all class definitions stat
in xstats
: If the companion class if not also defined
in xstats
, invalidate it by setting its info to NoType.
For all class definitions stat
in xstats
: If the companion class if not also defined
in xstats
, invalidate it by setting its info to NoType.
Is given type applicable to argument types args
, possibly after inserting an apply
?
Is given type applicable to argument types args
, possibly after inserting an apply
?
The expected result type of the application
Is given type applicable to type arguments targs
and argument trees args
,
possibly after inserting an apply
?
Is given type applicable to type arguments targs
and argument trees args
,
possibly after inserting an apply
?
The expected result type of the application
Is given method reference applicable to argument types args
?
Is given method reference applicable to argument types args
?
The expected result type of the application
Is given method reference applicable to type arguments targs
and argument trees args
?
Is given method reference applicable to type arguments targs
and argument trees args
?
The expected result type of the application
In a set of overloaded applicable alternatives, is alt1
at least as good as
alt2
? alt1
and alt2
are non-overloaded references.
In a set of overloaded applicable alternatives, is alt1
at least as good as
alt2
? alt1
and alt2
are non-overloaded references.
A type tp
is compatible with a type pt
if one of the following holds:
A type tp
is compatible with a type pt
if one of the following holds:
tp
is a subtype of pt
2. pt
is by name parameter type, and tp
is compatible with its underlying type
3. there is an implicit conversion from tp
to pt
.
4. tp
is a numeric subtype of pt
(this case applies even if implicit conversions are disabled)
Is given method reference applicable to type arguments targs
and argument trees args
without inferring views?
Is given method reference applicable to type arguments targs
and argument trees args
without inferring views?
The expected result type of the application
Determines whether this field holds an enum constant.
Determines whether this field holds an enum constant. To qualify, the following conditions must be met:
Check that all methods have MethodicType
A fresh local context with given tree and owner.
A fresh local context with given tree and owner. Owner might not exist (can happen for self valdefs), in which case no owner is set in result context
The signature of a module valdef.
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.
A map from method symbols to nested typers.
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.
Test compatibility after normalization in a fresh typerstate.
Test compatibility after normalization in a fresh typerstate.
Checks that the given tree has been typed
Checks that the given tree has been typed
The qualifying class of a this or super with prefix qual
(which might be empty).
The qualifying class of a this or super with prefix qual
(which might be empty).
A denotation exists really if it exists and does not point to a stale symbol.
A denotation exists really if it exists and does not point to a stale symbol.
Record sym
as the symbol defined by tree
Record sym
as the symbol defined by tree
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.
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?
Retrieve symbol attached to given tree
The scope of the typer.
The scope of the typer. For nested typers this is a place parameters are entered during completion and where they survive until typechecking. A context with this typer also has this scope.
The type of a selection with name
of a tree with type site
.
The type of a selection with name
of a tree with type site
.
The symbol of the given expanded tree.
If formal
is of the form ClassTag[T], where T
is a class type,
synthesize a class tag for T
.
If formal
is of the form ClassTag[T], where T
is a class type,
synthesize a class tag for T
.
Try op1
, if there are errors, try op2
, if op2
also causes errors, fall back
to errors and result of op1
.
Try op1
, if there are errors, try op2
, if op2
also causes errors, fall back
to errors and result of op1
.
Add apply node or implicit conversions.
Add apply node or implicit conversions. Two strategies are tried, and the first
that is successful is picked. If neither of the strategies are successful, continues with
fallBack
.
1st strategy: Try to insert .apply
so that the result conforms to prototype pt
.
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 this tree is a select node qual.name
, try to insert an implicit conversion
c
around qual
so that c(qual).name
conforms to pt
.
If this tree is a select node qual.name
, try to insert an implicit conversion
c
around qual
so that c(qual).name
conforms to pt
.
Type a case.
Translate selection that does not typecheck according to the normal rules into a applyDynamic/applyDynamicNamed.
Translate selection that does not typecheck according to the normal rules into a applyDynamic/applyDynamicNamed. foo.bar(baz0, baz1, ...) ~~> foo.applyDynamic(bar)(baz0, baz1, ...) foo.bar[T0, ...](baz0, baz1, ...) ~~> foo.applyDynamic[T0, ...](bar)(baz0, baz1, ...) foo.bar(x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamed("bar")(("x", bazX), ("y", bazY), ("", baz), ...) foo.bar[T0, ...](x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamed[T0, ...]("bar")(("x", bazX), ("y", bazY), ("", baz), ...)
Translate selection that does not typecheck according to the normal rules into a updateDynamic.
Translate selection that does not typecheck according to the normal rules into a updateDynamic. foo.bar = baz ~~> foo.updateDynamic(bar)(baz)
Translate selection that does not typecheck according to the normal rules into a selectDynamic.
Translate selection that does not typecheck according to the normal rules into a selectDynamic. foo.bar ~~> foo.selectDynamic(bar) foo.bar[T0, ...] ~~> foo.selectDynamic[T0, ...](bar)
Note: inner part of translation foo.bar(baz) = quux ~~> foo.selectDynamic(bar).update(baz, quux) is achieved through an existing transformation of in typedAssign [foo.bar(baz) = quux ~~> foo.bar.update(baz, quux)].
Attribute an identifier consisting of a simple name or wildcard
Attribute an identifier consisting of a simple name or wildcard
The tree representing the identifier. Transformations: (1) Prefix class members with this. (2) Change imported symbols to selections. (3) Change pattern Idents id (but not wildcards) to id @ _
Makes sure the symbol in the tree can be approximately reconstructed by
calling member
on the qualifier type.
Check that all defined symbols have legal owners.
Check that all defined symbols have legal owners. An owner is legal if it is either the same as the context's owner or there's an owner chain of valdefs starting at the context's owner and reaching up to the symbol's owner. The reason for this relaxed matching is that we should be able to pull out an expression as an initializer of a helper value without having to do a change owner traversal of the expression.
A typed unapply hook, can be overridden by re any-typers between frontend and pattern matcher.
A typed unapply hook, can be overridden by re any-typers between frontend and pattern matcher.
The type signature of a ValDef or DefDef
The type signature of a ValDef or DefDef
The definition
Its symbol
A wrapping function that produces the type of the defined symbol, given its final return type