class ImplicitSearch extends Analyzer.Typer with Analyzer.ImplicitsContextErrors
A class that sets up an implicit search. For more info, see comments for inferImplicit
.
- Source
- Implicits.scala
- Alphabetic
- By Inheritance
- ImplicitSearch
- ImplicitsContextErrors
- Typer
- TyperContextErrors
- PatternTyper
- Tag
- Adaptation
- TyperDiagnostics
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
ImplicitSearch(tree: Global.Tree, pt: Global.Type, isView: Boolean, context0: Analyzer.Context, pos0: Global.Position = NoPosition)
- tree
The tree for which the implicit needs to be inserted.
- pt
The original expected type of the implicit.
- isView
We are looking for a view
- context0
The context used for the implicit search
- pos0
Position that is preferable for use in tracing and error reporting (useful when we infer synthetic stuff and pass EmptyTree in the
tree
argument) If it's set to NoPosition, then position-based services will usetree.pos
Type Members
-
class
ImplicitComputation extends AnyRef
Prune ImplicitInfos down to either all the eligible ones or the best one.
Value Members
-
object
TyperErrorGen
- Definition Classes
- TyperContextErrors
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to any2stringadd[Analyzer.ImplicitSearch] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (Analyzer.ImplicitSearch, B)
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to ArrowAssoc[Analyzer.ImplicitSearch] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
AmbiguousImplicitError(info1: Analyzer.ImplicitInfo, tree1: Global.Tree, info2: Analyzer.ImplicitInfo, tree2: Global.Tree, pre1: String, pre2: String, trailer: String)(isView: Boolean, pt: Global.Type, tree: Global.Tree)(implicit context0: Analyzer.Context): Unit
- Definition Classes
- ImplicitsContextErrors
-
def
DivergingImplicitExpansionError(tree: Global.Tree, pt: Global.Type, sym: Global.Symbol)(implicit context0: Analyzer.Context): Unit
- Definition Classes
- ImplicitsContextErrors
-
def
acceptsApplyDynamic(tp: Global.Type): Boolean
- Attributes
- protected
- Definition Classes
- Typer
-
def
adapt(tree: Global.Tree, mode: Mode, pt: Global.Type, original: Global.Tree = EmptyTree): Global.Tree
Perform the following adaptations of expression, pattern or type
tree
wrt to given modemode
and given prototypept
: (-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 modemode
and given prototypept
: (-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, ifpt
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 topt
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, do SAM conversion (15) When in mode EXPRmode, apply a view If all this fails, error
Note: the
original
tree parameter is for re-typing implicit method invocations (see below) and should not be used otherwise. TODO: can it be replaced with a tree attachment?- Attributes
- protected
- Definition Classes
- Typer
-
def
adaptAfterOverloadResolution(tree: Global.Tree, mode: Mode, pt: Global.Type = WildcardType, original: Global.Tree = EmptyTree): Global.Tree
- Definition Classes
- Typer
-
def
adaptCase(cdef: Global.CaseDef, mode: Mode, tpe: Global.Type): Global.CaseDef
- Definition Classes
- Typer
-
def
adaptToArguments(qual: Global.Tree, name: Global.Name, args: List[Global.Tree], pt: Global.Type, reportAmbiguous: Boolean = true, saveErrors: Boolean = true): Global.Tree
Try to apply an implicit conversion to
qual
to that it contains a methodname
which can be applied to argumentsargs
with expected typept
.Try to apply an implicit conversion to
qual
to that it contains a methodname
which can be applied to argumentsargs
with expected typept
. Ifpt
is defined, there is a fallback to try again with pt = ?. This helps avoiding propagating result information too far and solves #1756. If no conversion is found, returnqual
unchanged.- Definition Classes
- Typer
-
def
adaptToMember(qual: Global.Tree, searchTemplate: Global.Type, reportAmbiguous: Boolean = true, saveErrors: Boolean = true): Global.Tree
- Definition Classes
- Typer
-
def
adaptToMemberWithArgs(tree: Global.Tree, qual: Global.Tree, name: Global.Name, mode: Mode, reportAmbiguous: Boolean = true, saveErrors: Boolean = true): Global.Tree
Try to apply an implicit conversion to
qual
so that it contains a methodname
.Try to apply an implicit conversion to
qual
so that it contains a methodname
. If that's ambiguous try taking arguments into account usingadaptToArguments
.- Definition Classes
- Typer
-
def
adaptToName(qual: Global.Tree, name: Global.Name): Global.Tree
Try to apply an implicit conversion to
qual
to that it contains a membername
of arbitrary type.Try to apply an implicit conversion to
qual
to that it contains a membername
of arbitrary type. If no conversion is found, returnqual
unchanged.- Definition Classes
- Typer
- def allImplicits: List[Analyzer.SearchResult]
- def allImplicitsPoly(tvars: List[Global.TypeVar]): List[(Analyzer.SearchResult, List[Global.TypeConstraint])]
-
def
analyzeSuperConsructor(meth: Global.Symbol, vparamss: List[List[Global.ValDef]], rhs: Global.Tree): Unit
Analyze the super constructor call to record information used later to compute parameter aliases
Analyze the super constructor call to record information used later to compute parameter aliases
- Definition Classes
- Typer
-
def
applicableInfos(iss: Analyzer.Infoss, isLocalToCallsite: Boolean): LinkedHashMap[Analyzer.ImplicitInfo, Analyzer.SearchResult]
Computes from a list of lists of implicit infos a map which takes infos which are applicable for given expected type
pt
to their attributed trees.Computes from a list of lists of implicit infos a map which takes infos which are applicable for given expected type
pt
to their attributed trees.- iss
The given list of lists of implicit infos
- isLocalToCallsite
Is implicit definition visible without prefix? If this is the case then symbols in preceding lists shadow symbols of the same name in succeeding lists.
- returns
map from infos to search results
-
def
applyImplicitArgs(fun: Global.Tree): Global.Tree
Find implicit arguments and pass them to given tree.
Find implicit arguments and pass them to given tree.
- Definition Classes
- Typer
-
def
approximate(tp: Global.Type): Global.Type
The expected type with all undetermined type parameters replaced with wildcards.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
atOwner(tree: Global.Tree, owner: Global.Symbol): Analyzer.Typer
- Definition Classes
- Typer
-
def
atOwner(owner: Global.Symbol): Analyzer.Typer
- Definition Classes
- Typer
-
def
bestImplicit: Analyzer.SearchResult
The result of the implicit search: First search implicits visible in current context.
The result of the implicit search: First search implicits visible in current context. If that fails, search implicits in expected type
pt
.todo. the following lines should be deleted after we migrate delegate tag materialization to implicit macros If that fails, and
pt
is an instance of a ClassTag, try to construct a class tag. If that fails, andpt
is an instance of a TypeTag, try to construct a type tag. If that fails, andpt
is an instance of a ClassManifest, try to construct a class manifest. If that fails, andpt
is an instance of a Manifest, try to construct a manifest. If that fails, andpt
is an instance of a OptManifest, try to construct a class manifest and return NoManifest if construction fails. If all fails return SearchFailure -
def
callToCompanionConstr(context: Analyzer.Context, calledFun: Global.Symbol): Boolean
- Definition Classes
- Typer
-
def
canAdaptConstantTypeToLiteral: Boolean
Overridden to false in scaladoc and/or interactive.
Overridden to false in scaladoc and/or interactive.
- Definition Classes
- Typer
-
def
canTranslateEmptyListToNil: Boolean
- Definition Classes
- Typer
-
def
checkClassType(tpt: Global.Tree): Boolean
Check that
tpt
refers to a non-refinement class typeCheck that
tpt
refers to a non-refinement class type- Definition Classes
- Typer
-
def
checkExistentialsFeature(pos: Global.Position, tpe: Global.Type, prefix: String): AnyVal
- Definition Classes
- Typer
-
def
checkFeature(pos: Global.Position, featureTrait: Global.Symbol, construct: ⇒ String = "", immediate: Boolean = false): Boolean
Check whether feature given by
featureTrait
is enabled.Check whether feature given by
featureTrait
is enabled. If it is not, issue an error or a warning depending on whether the feature is required.- construct
A string expression that is substituted for "#" in the feature description string
- immediate
When set, feature check is run immediately, otherwise it is run at the end of the typechecking run for the enclosing unit. This is done to avoid potential cyclic reference errors by implicits that are forced too early.
- returns
if feature check is run immediately: true if feature is enabled, false otherwise if feature check is delayed or suppressed because we are past typer: true
- Definition Classes
- Typer
-
def
checkFinitary(classinfo: Global.ClassInfoType): Unit
- Definition Classes
- Typer
-
def
checkMethodStructuralCompatible(ddef: Global.DefDef): Unit
Check if a structurally defined method violates implementation restrictions.
Check if a structurally defined method violates implementation restrictions. A method cannot be called if it is a non-private member of a refinement type and if its parameter's types are any of:
- the self-type of the refinement
- a type member of the refinement
- an abstract type declared outside of the refinement.
- an instance of a value class Furthermore, the result type may not be a value class either
- Definition Classes
- Typer
-
def
checkNonCyclic(defn: Global.Tree, tpt: Global.Tree): Unit
- Definition Classes
- Typer
-
def
checkNonCyclic(sym: Global.Symbol): Unit
- Definition Classes
- Typer
-
def
checkNonCyclic(pos: Global.Position, tp: Global.Type, lockedSym: Global.Symbol): Boolean
- Definition Classes
- Typer
-
def
checkNonCyclic(pos: Global.Position, tp: Global.Type): Boolean
Check that type
tp
is not a subtype of itself.Check that type
tp
is not a subtype of itself.- Definition Classes
- Typer
-
def
checkParamsConvertible(tree: Global.Tree, tpe0: Global.Type): Unit
- Definition Classes
- Typer
-
def
checkStablePrefixClassType(tpt: Global.Tree): Boolean
Check that
tpt
refers to a class type with a stable prefix.Check that
tpt
refers to a class type with a stable prefix.- Definition Classes
- Typer
-
def
checkValidAdaptation(t: Global.Tree, args: List[Global.Tree]): Boolean
- Definition Classes
- Adaptation
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
computeMacroDefType(ddef: Global.DefDef, pt: Global.Type): Global.Type
- Definition Classes
- Typer
-
def
computeType(tree: Global.Tree, pt: Global.Type): Global.Type
- Definition Classes
- Typer
-
final
def
constrTyperIf(inConstr: Boolean): Analyzer.Typer
The typer for an expression, depending on where we are.
The typer for an expression, depending on where we are. If we are before a superclass call, this is a typer over a constructor context; otherwise it is the current typer.
- Definition Classes
- Typer
-
var
context: Analyzer.Context
- Definition Classes
- Typer
- val context0: Analyzer.Context
-
def
context1: Analyzer.Context
- Definition Classes
- Typer
- def ctx_s: String
-
def
cyclicReferenceMessage(sym: Global.Symbol, tree: Global.Tree): Option[String]
Returns Some(msg) if the given tree is untyped apparently due to a cyclic reference, and None otherwise.
Returns Some(msg) if the given tree is untyped apparently due to a cyclic reference, and None otherwise.
- Definition Classes
- TyperDiagnostics
-
def
doTypedApply(tree: Global.Tree, fun0: Global.Tree, args: List[Global.Tree], mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
def
doTypedUnapply(tree: Global.Tree, funOrig: Global.Tree, funOverloadResolved: Global.Tree, args: List[Global.Tree], mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- PatternTyper
-
def
dropExistential(tp: Global.Type): Global.Type
- Definition Classes
- Typer
-
def
ensuring(cond: (Analyzer.ImplicitSearch) ⇒ Boolean, msg: ⇒ Any): Analyzer.ImplicitSearch
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to Ensuring[Analyzer.ImplicitSearch] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (Analyzer.ImplicitSearch) ⇒ Boolean): Analyzer.ImplicitSearch
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to Ensuring[Analyzer.ImplicitSearch] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): Analyzer.ImplicitSearch
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to Ensuring[Analyzer.ImplicitSearch] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): Analyzer.ImplicitSearch
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to Ensuring[Analyzer.ImplicitSearch] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
enterSym(txt: Analyzer.Context, tree: Global.Tree): Analyzer.Context
- Attributes
- protected
- Definition Classes
- Typer
-
def
enterSyms(txt: Analyzer.Context, trees: List[Global.Tree]): Unit
- Attributes
- protected
- Definition Classes
- Typer
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
extractorForUncheckedType(pos: Global.Position, pt: Global.Type): Global.Tree
- Definition Classes
- PatternTyper
-
final
def
failure(what: Any, reason: ⇒ String, pos: Global.Position = this.pos): Analyzer.SearchResult
- Annotations
- @inline()
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
finishMethodSynthesis(templ: Global.Template, clazz: Global.Symbol, context: Analyzer.Context): Global.Template
In order to override this in the TreeCheckers Typer so synthetics aren't re-added all the time, it is exposed here the module/class typing methods go through it.
In order to override this in the TreeCheckers Typer so synthetics aren't re-added all the time, it is exposed here the module/class typing methods go through it. ...but it turns out it's also the ideal spot for namer/typer coordination for the tricky method synthesis scenarios, so we'll make it that.
- Attributes
- protected
- Definition Classes
- Typer
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to StringFormat[Analyzer.ImplicitSearch] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
implicit
def
fresh: FreshNameCreator
- Definition Classes
- Typer
- final def functionArity(tp: Global.Type): Int
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
improves(info1: Analyzer.ImplicitInfo, info2: Analyzer.ImplicitInfo): Boolean
Is implicit info
info1
better than implicit infoinfo2
? -
val
infer: Analyzer.Inferencer
- Definition Classes
- Typer
-
def
inferSamType(fun: Global.Tree, pt: Global.Type, mode: Mode): Boolean
Synthesize and type check the implementation of a type with a Single Abstract Method.
Synthesize and type check the implementation of a type with a Single Abstract Method.
Based on a type checked Function node
{ (p1: T1, ..., pN: TN) => body } : S
whereS
is the expected type that defines a single abstract method (call itapply
for the example), that has signature(p1: T1', ..., pN: TN'): T'
, synthesize the instantiation of the following anonymous classnew S { def apply$body(p1: T1, ..., pN: TN): T = body def apply(p1: T1', ..., pN: TN'): T' = apply$body(p1,..., pN) }
The
apply
method is identified by the argumentsam
;S
corresponds to the argumentpt
, Ifpt
is not fully defined, we derivesamClassTpFullyDefined
by inferring any unknown type parameters.The types T1' ... TN' and T' are derived from the method signature of the sam method, as seen from the fully defined
samClassTpFullyDefined
.The function's body is put in a (static) method in the class definition to enforce scoping. S's members should not be in scope in
body
. (Putting it in the block outside the class runs into implementation problems described below)The restriction on implicit arguments (neither S's constructor, nor sam may take an implicit argument list), is to keep the implementation of type inference (the computation of
samClassTpFullyDefined
) simple.Impl notes:
fun
has a FunctionType, but the expected typept
is some SAM type -- let's remedy thatfun
is fully attributed, so we'll have to wrangle some symbols into shape (owner change, vparam syms)- after experimentation, it works best to type check function literals fully first and then adapt to a sam type, as opposed to a sam-specific code paths earlier on in type checking (in typedFunction). For one, we want to emit the same bytecode regardless of whether the expected function type is a built-in FunctionN or some SAM type
- Definition Classes
- Typer
-
def
inferView(tree: Global.Tree, from: Global.Type, to: Global.Type, reportAmbiguous: Boolean = true, saveErrors: Boolean = true): Global.Tree
Infer an implicit conversion (
view
) between two types.Infer an implicit conversion (
view
) between two types.- tree
The tree which needs to be converted.
- from
The source type of the conversion
- to
The target type of the conversion
- reportAmbiguous
Should ambiguous implicit errors be reported? False iff we search for a view to find out whether one type is coercible to another.
- saveErrors
Should ambiguous and divergent implicit errors that were buffered during the inference of a view be put into the original buffer. False iff we don't care about them.
- Definition Classes
- Typer
-
def
instantiate(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
def
instantiateExpectingUnit(tree: Global.Tree, mode: Mode): Global.Tree
If the expected type is Unit: try instantiating type arguments with expected type Unit, but if that fails, try again with pt = WildcardType and discard the expression.
If the expected type is Unit: try instantiating type arguments with expected type Unit, but if that fails, try again with pt = WildcardType and discard the expression.
- Definition Classes
- Typer
-
def
instantiatePossiblyExpectingUnit(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
def
isCapturedExistential(sym: Global.Symbol): Boolean
- Definition Classes
- Typer
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPlausiblyCompatible(tp: Global.Type, pt: Global.Type): Boolean
-
def
isReferencedFrom(ctx: Analyzer.Context, sym: Global.Symbol): Boolean
- Definition Classes
- Typer
-
def
isStale(sym: Global.Symbol): Boolean
A symbol is stale if it is toplevel, to be loaded from a classfile, and the classfile is produced from a sourcefile which is compiled in the current run.
A symbol is stale if it is toplevel, to be loaded from a classfile, and the classfile is produced from a sourcefile which is compiled in the current run.
- Definition Classes
- Typer
-
def
isValid(sym: Global.Symbol): Boolean
Should implicit definition symbol
sym
be considered for applicability testing? This is the case if one of the following holds:Should implicit definition symbol
sym
be considered for applicability testing? This is the case if one of the following holds:- the symbol's type is initialized
- the symbol comes from a classfile
- the symbol comes from a different sourcefile than the current one
- the symbol and the accessed symbol's definitions come before, and do not contain the closest enclosing definition, // see #3373
- the symbol's definition is a val, var, or def with an explicit result type The aim of this method is to prevent premature cyclic reference errors by computing the types of only those implicits for which one of these conditions is true.
- val isView: Boolean
-
def
labelTyper(ldef: Global.LabelDef): Analyzer.Typer
The typer for a label definition.
The typer for a label definition. If this is part of a template we first have to enter the label definition.
- Definition Classes
- Typer
-
final
def
lookupTransformed(tree: Global.Tree): Option[Global.Tree]
- Definition Classes
- Typer
-
def
macroImplementationNotFoundMessage(name: Global.Name): String
This file will be the death of me.
This file will be the death of me.
- Attributes
- protected
- Definition Classes
- TyperContextErrors
-
def
member(qual: Global.Type, name: Global.Name): Global.Symbol
The member with given name of given qualifier type
The member with given name of given qualifier type
- Definition Classes
- Typer
-
def
missingSelectErrorTree(tree: Global.Tree, qual: Global.Tree, name: Global.Name): Global.Tree
- Definition Classes
- Typer
-
def
mkInvoke(context: Analyzer.Context, tree: Global.Tree, qual: Global.Tree, name: Global.Name): Option[Global.Tree]
Translate selection that does not typecheck according to the normal rules into a selectDynamic/applyDynamic.
Translate selection that does not typecheck according to the normal rules into a selectDynamic/applyDynamic.
foo.method("blah") ~~> foo.applyDynamic("method")("blah") foo.method(x = "blah") ~~> foo.applyDynamicNamed("method")(("x", "blah")) foo.varia = 10 ~~> foo.updateDynamic("varia")(10) foo.field ~~> foo.selectDynamic("field") foo.arr(10) = 13 ~~> foo.selectDynamic("arr").update(10, 13)
what if we want foo.field == foo.selectDynamic("field") == 1, but
foo.field = 10
==foo.selectDynamic("field").update(10)
== () what would the signature for selectDynamic be? (hint: it needs to depend on whether an update call is coming or not)need to distinguish selectDynamic and applyDynamic somehow: the former must return the selected value, the latter must accept an apply or an update
- could have only selectDynamic and pass it a boolean whether more is to come, so that it can either return the bare value or something that can handle the apply/update HOWEVER that makes it hard to return unrelated values for the two cases --> selectDynamic's return type is now dependent on the boolean flag whether more is to come
- simplest solution: have two method calls
- Attributes
- protected
- Definition Classes
- Typer
-
def
namer: Analyzer.Namer
- Definition Classes
- Typer
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
needsInstantiation(tparams: List[Global.Symbol], formals: List[Global.Type], args: List[Global.Tree]): Boolean
Does function need to be instantiated, because a missing parameter in an argument closure overlaps with an uninstantiated formal?
Does function need to be instantiated, because a missing parameter in an argument closure overlaps with an uninstantiated formal?
- Definition Classes
- Typer
- def normSubType(tp: Global.Type, pt: Global.Type): Boolean
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
packCaptured(tpe: Global.Type): Global.Type
- Definition Classes
- Typer
-
def
packSymbols(hidden: List[Global.Symbol], tp: Global.Type): Global.Type
Compute an existential type from raw hidden symbols
syms
and typetp
Compute an existential type from raw hidden symbols
syms
and typetp
- Definition Classes
- Typer
-
def
packedType(tree: Global.Tree, owner: Global.Symbol): Global.Type
convert local symbols and skolems to existentials
convert local symbols and skolems to existentials
- Definition Classes
- Typer
-
def
packedTypes(trees: List[Global.Tree]): List[Global.Type]
- Definition Classes
- Typer
-
def
permanentlyHiddenWarning(pos: Global.Position, hidden: Global.Name, defn: Global.Symbol): Unit
- Definition Classes
- TyperDiagnostics
-
def
phasedAppliedType(sym: Global.Symbol, args: List[Global.Type]): Global.Type
- Definition Classes
- Typer
- def pos: Global.Position
- val pos0: Global.Position
- val pt: Global.Type
-
def
qualifyingClass(tree: Global.Tree, qual: Global.Name, packageOK: Boolean): Global.Symbol
The qualifying class of a this or super with prefix
qual
.The qualifying class of a this or super with prefix
qual
. packageOk is equal false when qualifying class symbol- Definition Classes
- Typer
-
def
reallyExists(sym: Global.Symbol): Boolean
Is symbol defined and not stale?
Is symbol defined and not stale?
- Definition Classes
- Typer
-
def
reenterTypeParams(tparams: List[Global.TypeDef]): List[Global.Symbol]
- Definition Classes
- Typer
-
def
reenterValueParams(vparamss: List[List[Global.ValDef]]): Unit
- Definition Classes
- Typer
-
def
reportTypeError(context0: Analyzer.Context, pos: Global.Position, ex: Global.TypeError): Unit
Report a type error.
Report a type error.
- pos
The position where to report the error
- ex
The exception that caused the error
- Definition Classes
- TyperDiagnostics
-
def
resolveClassTag(pos: Global.Position, tp: Global.Type, allowMaterialization: Boolean = true): Global.Tree
Finds in scope or materializes a ClassTag.
Finds in scope or materializes a ClassTag. Should be used instead of ClassManifest every time compiler needs to persist an erasure.
Once upon a time, we had an
ErasureTag
which was toClassTag
the same thatWeakTypeTag
is forTypeTag
. However we found out that we don't really need this concept, so it got removed.- pos
Position for error reporting. Please, provide meaningful value.
- tp
Type we're looking a ClassTag for, e.g. resolveClassTag(pos, IntTpe) will look for ClassTag[Int].
- allowMaterialization
If true (default) then the resolver is allowed to launch materialization macros when there's no class tag in scope. If false then materialization macros are prohibited from running.
- returns
Tree that represents an
scala.reflect.ClassTag
fortp
if everything is okay. EmptyTree if the result contains unresolved (i.e. not spliced) type parameters and abstract type members. EmptyTree ifallowMaterialization
is false, and there is no class tag in scope.
- Definition Classes
- Tag
-
def
resolveTypeTag(pos: Global.Position, pre: Global.Type, tp: Global.Type, concrete: Boolean, allowMaterialization: Boolean = true): Global.Tree
Finds in scope or materializes an WeakTypeTag (if
concrete
is false) or a TypeTag (ifconcrete
is true).Finds in scope or materializes an WeakTypeTag (if
concrete
is false) or a TypeTag (ifconcrete
is true).- pos
Position for error reporting. Please, provide meaningful value.
- pre
Prefix that represents a universe this type tag will be bound to. If
pre
is set toNoType
, then any type tag in scope will do, regardless of its affiliation. Ifpre
is set toNoType
, and tag resolution involves materialization, thenmkRuntimeUniverseRef
will be used.- tp
Type we're looking a TypeTag for, e.g. resolveTypeTag(pos, mkRuntimeUniverseRef, IntTpe, false) will look for scala.reflect.runtime.universe.TypeTag[Int].
- concrete
If true then the result must not contain unresolved (i.e. not spliced) type parameters and abstract type members. If false then the function will always succeed (abstract types will be reified as free types).
- allowMaterialization
If true (default) then the resolver is allowed to launch materialization macros when there's no type tag in scope. If false then materialization macros are prohibited from running.
- returns
Tree that represents a
scala.reflect.TypeTag
fortp
if everything is okay. EmptyTree ifconcrete
is true and the result contains unresolved (i.e. not spliced) type parameters and abstract type members. EmptyTree ifallowMaterialization
is false, and there is no array tag in scope.
- Definition Classes
- Tag
-
def
rewrappingWrapperTrees(f: (Global.Tree) ⇒ List[Global.Tree]): (Global.Tree) ⇒ List[Global.Tree]
For flatMapping a list of trees when you want the DocDefs and Annotated to be transparent.
For flatMapping a list of trees when you want the DocDefs and Annotated to be transparent.
- Definition Classes
- Typer
-
def
samToFunctionType(tp: Global.Type, sam: Global.Symbol = NoSymbol): Global.Type
Convert a SAM type to the corresponding FunctionType, extrapolating BoundedWildcardTypes in the process (no type precision is lost by the extrapolation, but this facilitates dealing with the types arising from Java's use-site variance).
Convert a SAM type to the corresponding FunctionType, extrapolating BoundedWildcardTypes in the process (no type precision is lost by the extrapolation, but this facilitates dealing with the types arising from Java's use-site variance).
- Definition Classes
- Typer
- val searchId: Int
-
def
searchImplicit(implicitInfoss: Analyzer.Infoss, isLocalToCallsite: Boolean): Analyzer.SearchResult
Search list of implicit info lists for one matching prototype
pt
.Search list of implicit info lists for one matching prototype
pt
. If found return a search result with a tree from found implicit info which is typed with expected typept
. Otherwise return SearchFailure.- implicitInfoss
The given list of lists of implicit infos
- isLocalToCallsite
Is implicit definition visible without prefix? If this is the case then symbols in preceding lists shadow symbols of the same name in succeeding lists.
-
def
silent[T](op: (Analyzer.Typer) ⇒ T, reportAmbiguousErrors: Boolean = context.ambiguousErrors, newtree: Global.Tree = context.tree): Analyzer.SilentResult[T]
- Definition Classes
- Typer
-
def
stabilize(tree: Global.Tree, pre: Global.Type, mode: Mode, pt: Global.Type): Global.Tree
Post-process an identifier or selection node, performing the following:
Post-process an identifier or selection node, performing the following:
- Check that non-function pattern expressions are stable (ignoring volatility concerns -- scala/bug#6815) (and narrow the type of modules: a module reference in a pattern has type Foo.type, not "object Foo") 2. Check that packages and static modules are not used as values 3. Turn tree type into stable type if possible and required by context. 4. Give getClass calls a more precise type based on the type of the target of the call.
- Attributes
- protected
- Definition Classes
- Typer
-
def
stabilizeFun(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
synthesizePartialFunction(paramName: Global.TermName, paramPos: Global.Position, paramSynthetic: Boolean, tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
synthesize and type check a PartialFunction implementation based on the match in
tree
synthesize and type check a PartialFunction implementation based on the match in
tree
param => sel match { cases }
becomes:new AbstractPartialFunction[$argTp, $matchResTp] { def applyOrElse[A1 <: $argTp, B1 >: $matchResTp]($param: A1, default: A1 => B1): B1 = $selector match { $cases } def isDefinedAt(x: $argTp): Boolean = $selector match { $casesTrue } }
TODO: it would be nicer to generate the tree specified above at once and type it as a whole, there are two gotchas:
- matchResTp may not be known until we've typed the match (can only use resTp when it's fully defined),
- if we typed the match in isolation first, you'd know its result type, but would have to re-jig the owner structure
- could we use a type variable for matchResTp and backpatch it?
- occurrences of
this
incases
orsel
must resolve to the this of the class originally enclosing the match, not of the anonymous partial function subclass
an alternative TODO: add partial function AST node or equivalent and get rid of this synthesis --> do everything in uncurry (or later) however, note that pattern matching codegen is designed to run *before* uncurry
- Definition Classes
- Typer
- matchResTp may not be known until we've typed the match (can only use resTp when it's fully defined),
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
transformedOr(tree: Global.Tree, op: ⇒ Global.Tree): Global.Tree
- Definition Classes
- Typer
- Annotations
- @inline()
-
final
def
transformedOrTyped(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
- Annotations
- @inline()
- val tree: Global.Tree
- def tree_s: String
-
final
def
typed(tree: Global.Tree, mode: Mode): Global.Tree
- Definition Classes
- Typer
- Annotations
- @inline()
-
final
def
typed(tree: Global.Tree, pt: Global.Type): Global.Tree
Types expression
tree
with given prototypept
.Types expression
tree
with given prototypept
.- Definition Classes
- Typer
- Annotations
- @inline()
-
final
def
typed(tree: Global.Tree): Global.Tree
Types expression or definition
tree
.Types expression or definition
tree
.- Definition Classes
- Typer
- Annotations
- @inline()
-
def
typed(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
def
typed1(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
def
typedAnnotation(ann: Global.Tree, mode: Mode = EXPRmode): Global.AnnotationInfo
Convert an annotation constructor call into an AnnotationInfo.
Convert an annotation constructor call into an AnnotationInfo.
- Definition Classes
- Typer
-
def
typedArg(arg: Global.Tree, mode: Mode, newmode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
def
typedArgs(args: List[Global.Tree], mode: Mode): collection.immutable.List[Global.Tree]
- Definition Classes
- Typer
-
def
typedArgsForFormals(args: List[Global.Tree], formals: List[Global.Type], mode: Mode): List[Global.Tree]
- Definition Classes
- PatternTyper
-
def
typedBlock(block0: Global.Block, mode: Mode, pt: Global.Type): Global.Block
- Definition Classes
- Typer
-
final
def
typedByValueExpr(tree: Global.Tree, pt: Global.Type = WildcardType): Global.Tree
- Definition Classes
- Typer
- Annotations
- @inline()
-
def
typedCase(cdef: Global.CaseDef, pattpe: Global.Type, pt: Global.Type): Global.CaseDef
- Definition Classes
- Typer
-
def
typedCases(cases: List[Global.CaseDef], pattp: Global.Type, pt: Global.Type): List[Global.CaseDef]
- Definition Classes
- Typer
-
def
typedClassDef(cdef: Global.ClassDef): Global.Tree
- Definition Classes
- Typer
-
def
typedClassOf(tree: Global.Tree, tpt: Global.Tree, noGen: Boolean = false): Global.Tree
- Definition Classes
- Typer
-
def
typedConstructorPattern(fun0: Global.Tree, pt: Global.Type): Global.Tree
- Definition Classes
- PatternTyper
-
def
typedDefDef(ddef: Global.DefDef): Global.DefDef
- Definition Classes
- Typer
-
def
typedDocDef(docDef: Global.DocDef, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
def
typedExistentialTypeTree(tree: Global.ExistentialTypeTree, mode: Mode): Global.Tree
- Attributes
- protected
- Definition Classes
- Typer
-
def
typedHigherKindedType(tree: Global.Tree, mode: Mode): Global.Tree
- Definition Classes
- Typer
-
def
typedHigherKindedType(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
Types a higher-kinded type tree -- pt denotes the expected kind and must be one of
Kind.WildCard
andKind.FromParams
Types a higher-kinded type tree -- pt denotes the expected kind and must be one of
Kind.WildCard
andKind.FromParams
- Definition Classes
- Typer
-
def
typedImport(imp: Global.Import): Global.Import
- Definition Classes
- Typer
-
def
typedInPattern(tree: Global.Typed, mode: Mode, pt: Global.Type): Global.Tree
- Attributes
- protected
- Definition Classes
- PatternTyper
-
def
typedLabelDef(ldef: Global.LabelDef): Global.LabelDef
- Definition Classes
- Typer
-
def
typedMatch(selector: Global.Tree, cases: List[Global.CaseDef], mode: Mode, pt: Global.Type, tree: Global.Tree = EmptyTree): Global.Match
- Definition Classes
- Typer
-
def
typedModifiers(mods: Global.Modifiers): Global.Modifiers
Remove definition annotations from modifiers (they have been saved into the symbol's
annotations
in the type completer / namer)Remove definition annotations from modifiers (they have been saved into the symbol's
annotations
in the type completer / namer)However reification does need annotation definitions to proceed. Unfortunately, AnnotationInfo doesn't provide enough info to reify it in general case. The biggest problem is with the "atp: Type" field, which cannot be reified in some situations that involve locally defined annotations. See more about that in Reifiers.scala.
That's why the original tree gets saved into
original
field of AnnotationInfo (happens elsewhere). The field doesn't get pickled/unpickled and exists only during a single compilation run. This simultaneously allows us to reify annotations and to preserve backward compatibility.- Definition Classes
- Typer
-
def
typedModuleDef(mdef: Global.ModuleDef): Global.Tree
- Definition Classes
- Typer
-
final
def
typedOperator(tree: Global.Tree): Global.Tree
Types function part of an application
Types function part of an application
- Definition Classes
- Typer
- Annotations
- @inline()
-
def
typedParentTypes(templ: Global.Template): List[Global.Tree]
- Definition Classes
- Typer
-
def
typedPattern(tree: Global.Tree, pt: Global.Type): Global.Tree
Types a pattern with prototype
pt
Types a pattern with prototype
pt
- Definition Classes
- Typer
-
def
typedPos(pos: Global.Position)(tree: Global.Tree): Global.Tree
- Definition Classes
- Typer
-
def
typedPos(pos: Global.Position, mode: Mode, pt: Global.Type)(tree: Global.Tree): Global.Tree
- Definition Classes
- Typer
-
final
def
typedQualifier(tree: Global.Tree): Global.Tree
- Definition Classes
- Typer
- Annotations
- @inline()
-
final
def
typedQualifier(tree: Global.Tree, mode: Mode): Global.Tree
Types qualifier
tree
of a select node.Types qualifier
tree
of a select node. E.g. is tree occurs in a context liketree.m
.- Definition Classes
- Typer
- Annotations
- @inline()
-
final
def
typedQualifier(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
Types qualifier
tree
of a select node.Types qualifier
tree
of a select node. E.g. is tree occurs in a context liketree.m
.- Definition Classes
- Typer
- Annotations
- @inline()
-
def
typedRefinement(templ: Global.Template): Unit
- Definition Classes
- Typer
-
def
typedStarInPattern(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree
- Attributes
- protected
- Definition Classes
- PatternTyper
-
def
typedStats(stats: List[Global.Tree], exprOwner: Global.Symbol): List[Global.Tree]
- Definition Classes
- Typer
-
def
typedTemplate(templ0: Global.Template, parents1: List[Global.Tree]): Global.Template
Check that inner classes do not inherit from Annotation
Check that inner classes do not inherit from Annotation
- Definition Classes
- Typer
-
def
typedType(tree: Global.Tree): Global.Tree
Types a (fully parameterized) type tree
Types a (fully parameterized) type tree
- Definition Classes
- Typer
-
def
typedType(tree: Global.Tree, mode: Mode): Global.Tree
Types a (fully parameterized) type tree
Types a (fully parameterized) type tree
- Definition Classes
- Typer
-
def
typedTypeApply(tree: Global.Tree, mode: Mode, fun: Global.Tree, args: List[Global.Tree]): Global.Tree
- Attributes
- protected
- Definition Classes
- Typer
-
def
typedTypeConstructor(tree: Global.Tree): Global.Tree
- Definition Classes
- Typer
-
def
typedTypeConstructor(tree: Global.Tree, mode: Mode): Global.Tree
Types a type constructor tree used in a new or supertype
Types a type constructor tree used in a new or supertype
- Definition Classes
- Typer
-
def
typedTypeDef(tdef: Global.TypeDef): Global.TypeDef
- Definition Classes
- Typer
-
def
typedValDef(vdef: Global.ValDef): Global.ValDef
- Definition Classes
- Typer
-
final
def
typerWithCondLocalContext[T](c: ⇒ Analyzer.Context)(cond: Boolean)(f: (Analyzer.Typer) ⇒ T): T
- Definition Classes
- Typer
- Annotations
- @inline()
-
final
def
typerWithLocalContext[T](c: Analyzer.Context)(f: (Analyzer.Typer) ⇒ T): T
- Definition Classes
- Typer
- Annotations
- @inline()
-
val
undetParams: List[Global.Symbol]
The type parameters to instantiate
- def undet_s: String
-
def
validateParentClasses(parents: List[Global.Tree], selfType: Global.Type): Unit
Check that
Check that
- all parents are class types,
- first parent class is not a mixin; following classes are mixins,
- final classes are not inherited,
- sealed classes are only inherited by classes which are nested within definition of base class, or that occur within same statement sequence,
- self-type of current class is a subtype of self-type of each parent class.
- no two parents define same symbol.
- Definition Classes
- Typer
-
def
viewExists(from: Global.Type, to: Global.Type): Boolean
- Definition Classes
- Typer
-
def
virtualizedMatch(match_: Global.Match, mode: Mode, pt: Global.Type): Global.Tree
- Definition Classes
- Typer
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
warnTypeParameterShadow(tparams: List[Global.TypeDef], sym: Global.Symbol): Unit
- Definition Classes
- TyperDiagnostics
- val wildPt: Global.Type
-
final
def
withCondConstrTyper[T](inConstr: Boolean)(f: (Analyzer.Typer) ⇒ T): T
- Definition Classes
- Typer
- Annotations
- @inline()
-
def
wrapClassTagUnapply(uncheckedPattern: Global.Tree, classTagExtractor: Global.Tree, pt: Global.Type): Global.Tree
- Definition Classes
- PatternTyper
-
def
wrapErrors(tree: Global.Tree, typeTree: (Analyzer.Typer) ⇒ Global.Tree): Global.Tree
- Attributes
- protected
- Definition Classes
- Typer
- def wrapResult(tree: Global.Tree): Analyzer.SearchResult
-
def
→[B](y: B): (Analyzer.ImplicitSearch, B)
- Implicit
- This member is added by an implicit conversion from Analyzer.ImplicitSearch to ArrowAssoc[Analyzer.ImplicitSearch] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
Deprecated Value Members
-
def
member(qual: Global.Tree, name: Global.Name): Global.Symbol
- Definition Classes
- Typer
- Annotations
- @deprecated
- Deprecated
(Since version 2.12.9) Use the overload accepting a Type.
The Scala compiler and reflection APIs.