Skip to content
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

"could not find implicit value for evidence parameter of type" -- implicits lost in separate compilations #7264

Closed
scabug opened this issue Mar 18, 2013 · 4 comments

Comments

@scabug
Copy link

scabug commented Mar 18, 2013

Scalac does not find implicits when the use site is compiled after the definition site. Attached is a project with two files. If the project is built using sbt clean compile, it is fine. Now go into sbt ~compile and modify the Test.scala file (e.g. by adding a whitespace anywhere). It won't compile anymore:

[error] /Users/hhrutz/Desktop/implicits_bug/src/main/scala/implicitsbug/Test.scala:5: could not find implicit value for evidence parameter of type implicitsbug.Preferences.Type[String]
[error]     p.put("value")
[error]          ^

Note that this is not an sbt issue. The same happens if you successively execute:

$ scalac src/main/scala/implicitsbug/Bug.scala 
$ scalac src/main/scala/implicitsbug/Test.scala 

What's worse, when Bug.scala is packaged and exported as a library, the implicit resolution fails for any project that tries to use this library.


Another odd thing is, once I refer to the implicit explicitly, the resolution works in successive calls:

object PrefsTest {
  def test(p: Preferences) {
    p.put("value")(Preferences.Type.string)
    p.put("ja!")  // now you see me!
  }
}
@scabug
Copy link
Author

scabug commented Mar 18, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7264?orig=1
Reporter: @Sciss
Affected Versions: 2.10.1
Attachments:

@scabug
Copy link
Author

scabug commented Jun 2, 2013

@Sciss said (edited on Jun 2, 2013 2:05:46 AM UTC):
I've just bumped into the same one (?) again. I have attached another example. To see, run sbt test:compile, the implicits are lost in the test sources.

The bug seems to occur with the type nested in an object. If I move Values to package top-level (out of companion object Foo), the compilation succeeds.

@scabug
Copy link
Author

scabug commented Jun 2, 2013

@scabug
Copy link
Author

scabug commented Jun 2, 2013

@retronym said:
scala/scala#2621

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

3 participants