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

Lazy and friends swallow fatal errors during implicit resolution #776

Closed
joroKr21 opened this issue Sep 29, 2017 · 8 comments
Closed

Lazy and friends swallow fatal errors during implicit resolution #776

joroKr21 opened this issue Sep 29, 2017 · 8 comments

Comments

@joroKr21
Copy link
Collaborator

c.inferImplicitValue seems to have quite an extreme opinion on what silent means:

trait Tc[A]
object Tc {
  implicit def materialize[A]: Tc[A] = macro materializeImpl[A]
  def materializeImpl[A](c: blackbox.Context): c.Tree =
    throw new OutOfMemoryError("Whoops, I ran out of memory during implicit resolution.")
}

object UseTc {
  implicitly[Tc[Int]] // out of memory
  implicitly[Lazy[Tc[Int]]] // missing implicit !?
}

Now what is the chance this ever happened? Very low.
Did it happen here: https://travis-ci.org/milessabin/shapeless/jobs/274500922? Who knows?

@joroKr21
Copy link
Collaborator Author

@milessabin
Copy link
Owner

Interesting! Yes, that, looks like it might be an explanation. If it is we should be able to make the 2.10.x problem go away by bumping up the heap and/or stacksize ... other things being equal I'd prefer to leave the Lazy's as they are in the example, at least for the time being.

@joroKr21
Copy link
Collaborator Author

#777 passed this time. Hopefully it continues to do so in the future. I don't give sbt more than 2g memory on my machine either.

Apart from that the issue with the swallowed error seems unfixable. silent = false just converts every error to "implicit search has failed. to find out the reason, turn on -Xlog-implicits". Very helpful... Maybe this can be fixed in scalac. But I can't find where the error is caught.

@joroKr21
Copy link
Collaborator Author

This is hit and miss. If you don't mind me asking, why do you want to keep the Lazy in tail position? It does nothing there.

@macalinao
Copy link

Thanks for reporting this. The solution for me was to add the following to my SBT_OPTS env var:

-Xmx6G -Xms6G -Xss2M

@joroKr21
Copy link
Collaborator Author

joroKr21 commented Oct 1, 2017

Wow, 6G is crazy 😱 I opened milessabin/kittens#61

@macalinao
Copy link

macalinao commented Oct 1, 2017 via email

@joroKr21
Copy link
Collaborator Author

joroKr21 commented Mar 1, 2018

Fixed in scalac by scala/scala#6344, nothing to be done here

@joroKr21 joroKr21 closed this as completed Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants