Skip to content

Implicit search sometimes fails to check if self type matches conversion function #3725

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

Closed
scabug opened this issue Aug 4, 2010 · 3 comments
Assignees

Comments

@scabug
Copy link

scabug commented Aug 4, 2010

I've come across an example where the implicit resolution procedure fails to notice that it can provide the no-op function x => x as an implicit function argument. Example attached. It's short but it's not really minimal - hope it's enough.

@scabug
Copy link
Author

scabug commented Aug 4, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3725?orig=1
Reporter: Daniel Ramage (dramage)
Attachments:

  • bug.scala (created on Aug 4, 2010 6:15:42 AM UTC, 1992 bytes)

@scabug
Copy link
Author

scabug commented Aug 9, 2010

@lrytz said:
here's a simplified version of the example

class D[T, U](x: T)(implicit toIt: T => Iterable[U]) { def foo(id: U => Int) = 0 }
implicit def iD[T, U](x: T)(implicit toIt: T => Iterable[U]) = new D(x)

val data : Iterable[Int] = List(1,2)

// OK
iD(data).foo((x: Int) => x)

// data.foo((x: Int) => x)
// <console>:16: error: could not find implicit value for parameter toIt: (Iterable[Int]) => Iterable[U]
//        data.foo((x: Int) => x)
//        ^

@scabug
Copy link
Author

scabug commented Aug 10, 2010

@adriaanm said:
duplicate of #3201 (see also #3346, #2781)
this should be fixed in 2.8.1

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