Constructors
Members
Temporary data item for single call to typed ident: This symbol would be found under Scala2 mode, but is not in dotty (because dotty conforms to spec se...
Temporary data item for single call to typed ident: This symbol would be found under Scala2 mode, but is not in dotty (because dotty conforms to spec section 2 wrt to package member resolution but scalac doe not).
A temporary data item valid for a single typed ident: The set of all root import symbols that have been encountered as a qualifier of an import so far. N...
A temporary data item valid for a single typed ident: The set of all root import symbols that have been encountered as a qualifier of an import so far. Note: It would be more proper to move importedFromRoot into typedIdent. We should check that this has no performance degradation, however.
Perform the following adaptations of expression, pattern or type tree
wrt to
given prototype pt
:
(1) Resolve overloading
(2) Apply parameterless function...
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
Overridden in retyper
Overridden 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.
If this is a real class, make sure its first parent is a constructor call. Cannot simply use a type. Overridden in ReTyper.
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 i...
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 - there is a parent P_i such that P_i derives from C, and - for every class D: If some parent P_j, j <= i derives from D, then C derives from D. Then, let CT be the smallest type which - has C as its class symbol, and - for all parents P_i: If P_i derives from C then P_i <:< CT.
Ensure that an expression's type can be expressed without references to locally defined symbols. This is done by adding a type ascription of a widened...
Ensure that an expression's type can be expressed without references to locally defined
symbols. This is done by adding a type ascription of a widened type that does
not refer to the locally defined symbols. The widened type is computed using
TyperAssigner#avoid
. However, if the expected type is fully defined and not
a supertype of the widened type, we ascribe with the expected type instead.
There's a special case having to do with anonymous classes. Sometimes the expected type of a block is the anonymous class defined inside it. In that case there's technically a leak which is not removed by the ascription.
Temporary data item for single call to typed ident: This symbol would be found under Scala2 mode, but is not in dotty (because dotty conforms to spec se...
Temporary data item for single call to typed ident: This symbol would be found under Scala2 mode, but is not in dotty (because dotty conforms to spec section 2 wrt to package member resolution but scalac doe not).
Let tree = p.n
where p: T
. If tree's type is an unsafe instantiation
(see TypeOps#asSeenFrom for how this can happen), rewrite the prefix p
to (p: <unkn...
Let tree = p.n
where p: T
. If tree's type is an unsafe instantiation
(see TypeOps#asSeenFrom for how this can happen), rewrite the prefix p
to (p: <unknown skolem of type T>)
and try again with the new (stable)
prefix. If the result has another unsafe instantiation, raise an error.
Given an inline method mdef
, the method rewritten so that its body
uses accessors to access non-public members, followed by the accessor definitions.
Ov...
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.
Is pt
a prototype of an apply
selection, or a parameterless function yielding one?
Is pt
a prototype of an apply
selection, or a parameterless function yielding one?
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
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
Define a new symbol associated with a Bind or pattern wildcard and make it gadt narrowable.
Define a new symbol associated with a Bind or pattern wildcard and make it gadt narrowable.
Adds inline to final vals with idempotent rhs
duplicating scalac behavior: for final vals that have rhs as constant, we do not create a field and instea...
Adds inline to final vals with idempotent rhs
duplicating scalac behavior: for final vals that have rhs as constant, we do not create a field and instead return the value. This seemingly minor optimization has huge effect on initialization order and the values that can be observed during superconstructor call
see remark about idempotency in PostTyper#normalizeTree
Add a @volitile to lazy vals when rewriting from Scala2
Add a @volitile to lazy vals when rewriting from Scala2
Retrieve symbol attached to given tree
Retrieve symbol attached to given tree
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
.
Potentially add apply node or implicit conversions. Before trying either, if the function is applied to an empty parameter list (), we try
0th strategy:...
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.
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
.
For a typed tree e: T
, if T
is an abstract type for which an implicit class tag ctag
exists, rewrite to ctag(e)
.
For a typed tree e: T
, if T
is an abstract type for which an implicit class tag ctag
exists, rewrite to ctag(e)
.
Type a case. Overridden in ReTyper, that's why it's separate from typedCases.
Type a case. Overridden in ReTyper, that's why it's separate from typedCases.
Attribute an identifier consisting of a simple name or wildcard
Attribute an identifier consisting of a simple name or wildcard
A temporary data item valid for a single typed ident: The set of all root import symbols that have been encountered as a qualifier of an import so far. N...
A temporary data item valid for a single typed ident: The set of all root import symbols that have been encountered as a qualifier of an import so far. Note: It would be more proper to move importedFromRoot into typedIdent. We should check that this has no performance degradation, however.