trait AnalyzerPlugin extends AnyRef
- Alphabetic
- By Inheritance
- AnalyzerPlugin
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Value Members
- 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 (AnalyzerPlugins.this)#AnalyzerPlugin toany2stringadd[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): ((AnalyzerPlugins.this)#AnalyzerPlugin, B)
- Implicit
- This member is added by an implicit conversion from (AnalyzerPlugins.this)#AnalyzerPlugin toArrowAssoc[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def adaptAnnotations(tree: Global.Tree, typer: (AnalyzerPlugins.this)#Typer, mode: Mode, pt: Global.Type): Global.Tree
Adapt a tree that has an annotated type to the given type tp, taking into account the given mode (see method adapt in trait Typers).
Adapt a tree that has an annotated type to the given type tp, taking into account the given mode (see method adapt in trait Typers).
An implementation cannot rely on canAdaptAnnotations being called before. If the implementing class cannot do the adapting, it should return the tree unchanged.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def canAdaptAnnotations(tree: Global.Tree, typer: (AnalyzerPlugins.this)#Typer, mode: Mode, pt: Global.Type): Boolean
Decide whether this analyzer plugin can adapt a tree that has an annotated type to the given type tp, taking into account the given mode (see method adapt in trait Typers).
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def ensuring(cond: ((AnalyzerPlugins.this)#AnalyzerPlugin) => Boolean, msg: => Any): (AnalyzerPlugins.this)#AnalyzerPlugin
- Implicit
- This member is added by an implicit conversion from (AnalyzerPlugins.this)#AnalyzerPlugin toEnsuring[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: ((AnalyzerPlugins.this)#AnalyzerPlugin) => Boolean): (AnalyzerPlugins.this)#AnalyzerPlugin
- Implicit
- This member is added by an implicit conversion from (AnalyzerPlugins.this)#AnalyzerPlugin toEnsuring[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): (AnalyzerPlugins.this)#AnalyzerPlugin
- Implicit
- This member is added by an implicit conversion from (AnalyzerPlugins.this)#AnalyzerPlugin toEnsuring[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): (AnalyzerPlugins.this)#AnalyzerPlugin
- Implicit
- This member is added by an implicit conversion from (AnalyzerPlugins.this)#AnalyzerPlugin toEnsuring[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def isActive(): Boolean
Selectively activate this analyzer plugin, e.g.
Selectively activate this analyzer plugin, e.g. according to the compiler phase.
Note that the current phase can differ from the global compiler phase (look for
enteringPhase
invocations in the compiler). For instance, lazy types created by the UnPickler are completed at the phase in which their symbol is created. Observations show that this can even be the parser phase. Since symbol completion can trigger subtyping, typing etc, your plugin might need to be active also in phases other than namer and typer.Typically, this method can be implemented as
global.phase.id < global.currentRun.picklerPhase.id
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noImplicitFoundError(param: Global.Symbol, errors: List[(AnalyzerPlugins.this)#ImplicitError], previous: String): String
Construct a custom error message for implicit parameters that could not be resolved.
Construct a custom error message for implicit parameters that could not be resolved.
- param
The implicit parameter that was resolved
- errors
The chain of intermediate implicits that lead to this error
- previous
The error message constructed by the previous analyzer plugin, or the builtin default
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def pluginsNotifyImplicitSearch(search: (AnalyzerPlugins.this)#ImplicitSearch): Unit
Access the search instance that will be used for the implicit search.
Access the search instance that will be used for the implicit search.
The motivation of this method is to allow analyzer plugins to control when/where implicit search are triggered, and access their environment for data capturing purposes.
- search
The instance that holds all the information about a given implicit search.
- def pluginsNotifyImplicitSearchResult(result: (AnalyzerPlugins.this)#SearchResult): Unit
Access the implicit search result from Scalac's typechecker.
Access the implicit search result from Scalac's typechecker.
The motivation of this method is to allow analyzer plugins to control when/where implicit search results are returned, and inspect them for data capturing purposes.
- result
The result to a given implicit search.
- def pluginsPt(pt: Global.Type, typer: (AnalyzerPlugins.this)#Typer, tree: Global.Tree, mode: Mode): Global.Type
Let analyzer plugins change the expected type before type checking a tree.
- def pluginsTypeSig(tpe: Global.Type, typer: (AnalyzerPlugins.this)#Typer, defTree: Global.Tree, pt: Global.Type): Global.Type
Let analyzer plugins change the types assigned to definitions.
Let analyzer plugins change the types assigned to definitions. For definitions that have an annotated type, the assigned type is obtained by typing that type tree. Otherwise, the type is inferred by typing the definition's righthand side, or from the overridden member under
-Xsource-features
.In order to know if the type was inferred, you can query the
wasEmpty
field in thetpt
TypeTree of the definition (for DefDef and ValDef).(*) If the type of a method or value is inferred, the type-checked tree is stored in the
analyzer.transformed
hash map, indexed by the definition's rhs tree.NOTE: Invoking the type checker can lead to cyclic reference errors. For instance, if this method is called from the type completer of a recursive method, type checking the method rhs will invoke the same completer again. It might be possible to avoid this situation by assigning
tpe
todefTree.symbol
(untested) - the final type computed by this method will then be assigned to the definition's symbol by monoTypeCompleter (in Namers).The hooks into
typeSig
allow analyzer plugins to add annotations to (or change the types of) definition symbols. This cannot not be achieved by usingpluginsTyped
: this method is only called during type checking, so changing the type of a symbol at this point is too late: references to the symbol might already be typed and therefore obtain the original type assigned during naming.- defTree
is the definition for which the type was computed. The different cases are outlined below. Note that this type is untyped (for methods and values with inferred type, the typed rhs trees are available in analyzer.transformed). Case defTree: Template
- tpe : A ClassInfoType for the template
- typer: The typer for template members, i.e. expressions and definitions of defTree.body
- pt : WildcardType
- the class symbol is accessible through typer.context.owner Case defTree: ClassDef
- tpe : A ClassInfoType, or a PolyType(params, ClassInfoType) for polymorphic classes. The class type is the one computed by templateSig, i.e. through the above case
- typer: The typer for the class. Note that this typer has a different context than the typer for the template.
- pt : WildcardType Case defTree: ModuleDef
- tpe : A ClassInfoType computed by templateSig
- typer: The typer for the module. context.owner of this typer is the module class symbol
- pt : WildcardType Case defTree: DefDef
- tpe : The type of the method (MethodType, PolyType or NullaryMethodType). (*)
- typer: The typer the rhs of this method
- pt : If tpt.isEmpty, either the result type from the overridden method, or WildcardType. Otherwise the type obtained from typing tpt.
- Note that for constructors, pt is the class type which the constructor creates. To type check the rhs of the constructor however, the expected type has to be WildcardType (see Typers.typedDefDef) Case defTree: ValDef
- tpe : The type of this value. (*)
- typer: The typer for the rhs of this value
- pt : If tpt.isEmpty, WildcardType. Otherwise the type obtained from typing tpt.
- Note that pluginsTypeSig might be called multiple times for the same ValDef since it is
used to compute the types of the accessor methods (see
pluginsTypeSigAccessor
) Case defTree: TypeDef - tpe : The type obtained from typing rhs (PolyType if the TypeDef defines a polymorphic type)
- typer: The typer for the rhs of this type
- pt : WildcardType
- def pluginsTypeSigAccessor(tpe: Global.Type, typer: (AnalyzerPlugins.this)#Typer, tree: Global.ValDef, sym: Global.Symbol): Global.Type
Modify the types of field accessors.
Modify the types of field accessors. The namer phase creates method types for getters and setters based on the type of the corresponding field.
Note: in order to compute the method type of an accessor, the namer calls
typeSig
on theValDef
tree of the corresponding field. This implies that thepluginsTypeSig
method is potentially called multiple times for the same ValDef tree.- tpe
The method type created by the namer for the accessor
- typer
The typer for the ValDef (not for the rhs)
- tree
The ValDef corresponding to the accessor
- sym
The accessor method symbol (getter, setter, beanGetter or beanSetter)
- def pluginsTyped(tpe: Global.Type, typer: (AnalyzerPlugins.this)#Typer, tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Type
Let analyzer plugins modify the type that has been computed for a tree.
Let analyzer plugins modify the type that has been computed for a tree.
- tpe
The type inferred by the type checker, initially (for first plugin)
tree.tpe
- typer
The typer that type checked
tree
- tree
The type-checked tree
- mode
Mode that was used for typing
tree
- pt
Expected type that was used for typing
tree
- def pluginsTypedReturn(tpe: Global.Type, typer: (AnalyzerPlugins.this)#Typer, tree: Global.Return, pt: Global.Type): Global.Type
Modify the type of a return expression.
Modify the type of a return expression. By default, return expressions have type NothingTpe.
- tpe
The type of the return expression
- typer
The typer that was used for typing the return tree
- tree
The typed return expression tree
- pt
The return type of the enclosing method
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from (AnalyzerPlugins.this)#AnalyzerPlugin toStringFormat[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): ((AnalyzerPlugins.this)#AnalyzerPlugin, B)
- Implicit
- This member is added by an implicit conversion from (AnalyzerPlugins.this)#AnalyzerPlugin toArrowAssoc[(AnalyzerPlugins.this)#AnalyzerPlugin] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
The Scala compiler and reflection APIs.