Skip to content

Implicit lookup fails for implicit def which returns a path-dependent type #5643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
scabug opened this issue Apr 3, 2012 · 3 comments
Open

Comments

@scabug
Copy link

scabug commented Apr 3, 2012

In the following code, the 2nd call to f at the end fails to find the implicit value of type GetResult[(String, String)]. The version with the explicit getTuple call succeeds.

object TupledEvidenceTest {

  abstract class TupledEvidence[M[_], T] { type T }

  implicit def witnessTuple2[M[_], T1, T2](implicit ev1: M[T1], ev2: M[T2]):
    TupledEvidence[M, (T1, T2)] { type T = (T1, T2) } = sys.error("")

  class GetResult[T]

  implicit val getString = new GetResult[String]

  implicit def getTuple[T](implicit w: TupledEvidence[GetResult, T]): GetResult[w.T] = sys.error("")

  def f[T : GetResult] = ""

  f[(String,String)](getTuple[(String, String)])

  f[(String,String)]
}

Both calls work if you use the following version of getTuple without the path-dependent return type.

  implicit def getTuple[T](implicit w: TupledEvidence[GetResult, T]): GetResult[T] = sys.error("")
@scabug
Copy link
Author

scabug commented Apr 3, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5643?orig=1
Reporter: @szeiger
Affected Versions: 2.9.1, 2.10.0
See #5070

@scabug
Copy link
Author

scabug commented May 21, 2012

@scabug
Copy link
Author

scabug commented Jul 10, 2013

@adriaanm said:
Unassigning and rescheduling to M6 as previous deadline was missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants