Perform the following adaptations of expression, pattern or type tree
wrt to
given mode mode
and given prototype pt
:
(-1) For expressions with annotated types, let AnnotationCheckers decide what to do
(0) Convert expressions with constant types to literals (unless in interactive/scaladoc mode)
(1) Resolve overloading, unless mode contains FUNmode
(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 mode mode
and given prototype pt
:
(-1) For expressions with annotated types, let AnnotationCheckers decide what to do
(0) Convert expressions with constant types to literals (unless in interactive/scaladoc mode)
(1) Resolve overloading, unless mode contains FUNmode
(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