@@ -4,7 +4,7 @@ package tastyreflect
44import dotty .tools .dotc .ast .Trees .SeqLiteral
55import dotty .tools .dotc .ast .{Trees , tpd , untpd }
66import dotty .tools .dotc .ast .tpd .TreeOps
7- import dotty .tools .dotc .typer .Typer
7+ import dotty .tools .dotc .typer .{ Implicits , Typer }
88import dotty .tools .dotc .core ._
99import dotty .tools .dotc .core .Flags ._
1010import dotty .tools .dotc .core .StdNames .nme
@@ -13,6 +13,7 @@ import dotty.tools.dotc.core.Symbols._
1313import dotty .tools .dotc .core .Decorators ._
1414import dotty .tools .dotc .tastyreflect .FromSymbol .{definitionFromSym , packageDefFromSym }
1515import dotty .tools .dotc .parsing .Parsers .Parser
16+ import dotty .tools .dotc .typer .Implicits .{AmbiguousImplicits , DivergingImplicit , NoMatchingImplicits , SearchFailure , SearchFailureType }
1617import dotty .tools .dotc .util .SourceFile
1718
1819import scala .tasty .reflect .Kernel
@@ -1849,6 +1850,48 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
18491850 def Definitions_NullType : Type = defn.NullType
18501851 def Definitions_StringType : Type = defn.StringType
18511852
1853+ //
1854+ // IMPLICITS
1855+ //
1856+
1857+ type ImplicitSearchResult = Tree
1858+
1859+ def searchImplicit (tpe : Type )(implicit ctx : Context ): ImplicitSearchResult =
1860+ ctx.typer.inferImplicitArg(tpe, rootPosition.span)
1861+
1862+ type ImplicitSearchSuccess = Tree
1863+ def matchImplicitSearchSuccess (isr : ImplicitSearchResult )(implicit ctx : Context ): Option [ImplicitSearchSuccess ] = isr.tpe match {
1864+ case _ : SearchFailureType => None
1865+ case _ => Some (isr)
1866+ }
1867+ def ImplicitSearchSuccess_tree (self : ImplicitSearchSuccess )(implicit ctx : Context ): Term = self
1868+
1869+ type ImplicitSearchFailure = Tree
1870+ def matchImplicitSearchFailure (isr : ImplicitSearchResult )(implicit ctx : Context ): Option [ImplicitSearchFailure ] = isr.tpe match {
1871+ case _ : SearchFailureType => Some (isr)
1872+ case _ => None
1873+ }
1874+ def ImplicitSearchFailure_explanation (self : ImplicitSearchFailure )(implicit ctx : Context ): String =
1875+ self.tpe.asInstanceOf [SearchFailureType ].explanation
1876+
1877+ type DivergingImplicit = Tree
1878+ def matchDivergingImplicit (isr : ImplicitSearchResult )(implicit ctx : Context ): Option [DivergingImplicit ] = isr.tpe match {
1879+ case _ : Implicits .DivergingImplicit => Some (isr)
1880+ case _ => None
1881+ }
1882+
1883+ type NoMatchingImplicits = Tree
1884+ def matchNoMatchingImplicits (isr : ImplicitSearchResult )(implicit ctx : Context ): Option [NoMatchingImplicits ] = isr.tpe match {
1885+ case _ : Implicits .NoMatchingImplicits => Some (isr)
1886+ case _ => None
1887+ }
1888+
1889+ type AmbiguousImplicits = Tree
1890+ def matchAmbiguousImplicits (isr : ImplicitSearchResult )(implicit ctx : Context ): Option [AmbiguousImplicits ] = isr.tpe match {
1891+ case _ : Implicits .AmbiguousImplicits => Some (isr)
1892+ case _ => None
1893+ }
1894+
18521895 //
18531896 // HELPERS
18541897 //
0 commit comments