trait Implicits extends AnyRef
This trait provides methods to find various kinds of implicits.
- Self Type
- Analyzer
- Source
- Implicits.scala
- Alphabetic
- By Inheritance
- Implicits
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Type Members
- class ImplicitAnnotationMsg extends AnyRef
- class ImplicitInfo extends AnyRef
A class that records an available implicit
- class ImplicitSearch extends Analyzer.Typer with Analyzer.ImplicitsContextErrors
A class that sets up an implicit search.
A class that sets up an implicit search. For more info, see comments for
inferImplicit
. - class Message extends AnyRef
- case class OpenImplicit(info: Analyzer.ImplicitInfo, pt: Global.Type, tree: Global.Tree) extends Product with Serializable
A class which is used to track pending implicits to prevent infinite implicit searches.
- class SearchResult extends AnyRef
The result of an implicit search
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Implicits, B)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- lazy val AmbiguousSearchFailure: Analyzer.SearchResult
- lazy val DivergentSearchFailure: Analyzer.SearchResult
- val NoImplicitInfo: Analyzer.ImplicitInfo
A sentinel indicating no implicit was found
- lazy val SearchFailure: Analyzer.SearchResult
- def SearchedPrefixImplicitInfo(pre: Global.Type): Analyzer.ImplicitInfo
- def allViewsFrom(tp: Global.Type, context: Analyzer.Context, tpars: List[Global.Symbol]): List[(Analyzer.SearchResult, List[Global.TypeConstraint])]
Find all views from type
tp
(in whichtpars
are free)Find all views from type
tp
(in whichtpars
are free)Note that the trees in the search results in the returned list share the same type variables. Ignore their constr field! The list of type constraints returned along with each tree specifies the constraints that must be met by the corresponding type parameter in
tpars
(for the returned implicit view to be valid).- tp
from-type for the implicit conversion
- context
search implicits here
- tpars
symbols that should be considered free type variables (implicit search should not try to solve them, just track their constraints)
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def ensuring(cond: (Implicits) => Boolean, msg: => Any): Implicits
- def ensuring(cond: (Implicits) => Boolean): Implicits
- def ensuring(cond: Boolean, msg: => Any): Implicits
- def ensuring(cond: Boolean): Implicits
- 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])
- def formatted(fmtstr: String): String
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def inferImplicit(tree: Global.Tree, pt: Global.Type, isView: Boolean, context: Analyzer.Context, silent: Boolean, withMacrosDisabled: Boolean, pos: Global.Position, onError: (Global.Position, String) => Unit): Global.Tree
A friendly wrapper over inferImplicit to be used in macro contexts and toolboxes.
- def inferImplicit(tree: Global.Tree, pt: Global.Type, reportAmbiguous: Boolean, isView: Boolean, context: Analyzer.Context, saveAmbiguousDivergent: Boolean, pos: Global.Position): Analyzer.SearchResult
Search for an implicit value.
Search for an implicit value. Consider using one of the convenience methods above. This one has many boolean levers.
See the comment on
result
at the end of classImplicitSearch
for more info how the search is conducted.- tree
The tree for which the implicit needs to be inserted. (the inference might instantiate some of the undetermined type parameters of that tree.
- pt
The expected type of the implicit.
- reportAmbiguous
Should ambiguous implicit errors be reported? False iff we search for a view to find out whether one type is coercible to another.
- isView
We are looking for a view
- context
The current context
- saveAmbiguousDivergent
False if any divergent/ambiguous errors should be ignored after implicits search, true if they should be reported (used in further typechecking).
- pos
Position that should be used for 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
- returns
A search result
- def inferImplicitByType(pt: Global.Type, context: Analyzer.Context, pos: Global.Position = NoPosition): Analyzer.SearchResult
- def inferImplicitByTypeSilent(pt: Global.Type, context: Analyzer.Context, pos: Global.Position = NoPosition): Analyzer.SearchResult
- def inferImplicitFor(pt: Global.Type, tree: Global.Tree, context: Analyzer.Context, reportAmbiguous: Boolean = true): Analyzer.SearchResult
- def inferImplicitView(from: Global.Type, to: Global.Type, tree: Global.Tree, context: Analyzer.Context, reportAmbiguous: Boolean, saveAmbiguousDivergent: Boolean): Analyzer.SearchResult
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def memberWildcardType(name: Global.Name, tp: Global.Type): Global.Type
A constructor for types ?{ def/type name: tp }, used in infer view to member searches.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def resetImplicits(): Unit
- 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()
- object Function1
An extractor for unary function types arg => res
- object HasMember
An extractor for types of the form ? { name: ? }
- object HasMethodMatching
An extractor for types of the form ? { name: (? >: argtpe <: Any*)restp }
- object ImplicitAmbiguousMsg extends Analyzer.ImplicitAnnotationMsg
- object ImplicitNotFoundMsg extends Analyzer.ImplicitAnnotationMsg
- object OpenImplicit extends java.io.Serializable
- object Shadower
Deprecated Value Members
- def inferImplicit(tree: Global.Tree, pt: Global.Type, reportAmbiguous: Boolean, isView: Boolean, context: Analyzer.Context, saveAmbiguousDivergent: Boolean): Analyzer.SearchResult
- Annotations
- @deprecated
- Deprecated
(Since version 2.12.0-M4) Unused in scalac
- def inferImplicit(tree: Global.Tree, pt: Global.Type, reportAmbiguous: Boolean, isView: Boolean, context: Analyzer.Context): Analyzer.SearchResult
- Annotations
- @deprecated
- Deprecated
(Since version 2.12.0-M4) Unused in scalac
- def →[B](y: B): (Implicits, B)
- Implicit
- This member is added by an implicit conversion from Implicits toArrowAssoc[Implicits] 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.