A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://issues.scala-lang.org/browse/SI-3346 below:

the implicit arguments of implicit conversions do not guide type inference · Issue #3346 · scala/bug · GitHub

object Test {
  class Rep[T](x : T)
 
  class SomeOps[T](x : Rep[T]) { def foo = 1 }
  implicit def mkOps[X, T](x : X)(implicit conv: X => Rep[T]) : SomeOps[T] = new SomeOps(conv(x))

  val a: Rep[Int] = error("")
  a.foo // infers mkOps(a).foo but rejects it because the types don't work out
// mkOps(a) will have type SomeOps[T] where T hasn't been instantiated because 
// the implicit search for mkOps's implicit argument hasn't been performed yet
}

relevant code from Implicits.scala

    /** The type parameters to instantiate */
    val undetParams = if (isView) List() else context.outer.undetparams // TODO: why the empty list for a view? why is this a val?
          if (itree2.tpe.isError) SearchFailure
          else if (hasMatchingSymbol(itree1)) {
            val tvars = undetParams map freshVar
            println("matchesPt??: "+(undetParams, context.undetparams, context.outer.undetparams)) // note that they are different!
            if (matchesPt(itree2.tpe /* itree2.tpe may contain typeparams from context.undetparams that will get instantiated later (during 2nd-order implicit search)*/, 
              pt.instantiateTypeParams(undetParams, tvars), undetParams)) {

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4