Skip to content

Don't use tryWithFallback #2493

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

Merged
merged 2 commits into from
May 23, 2017

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 21, 2017

Why not?

  • It's a hack
  • It can add a factor of two for a failed implicit search,
    which can add up
  • It swallows up useful info for the first implicit search
    which caused the fallback.

The only test failing after removal was t2429.scala. That test
was originally for an issue where scalac crashed. It involves
some fairly exotic code over List[Nothing]'s. I think we can
ignore it for now, and just add the type annotation to make it
compile.

The commit also contains some improvements for implicit search diagnostics and a test that was used to find the issues. Originally the goal was to get better info out of -explain-implicits. That's still unfulfilled, but at least the search does not become weird anymore. Previously, instead of getting an "implicit not found" error we got a an ambiguous implicit because the fallback tried again with a wildcard expected type.

odersky added 2 commits May 21, 2017 19:24
Why not?

 - It's a hack
 - It can add a factor of two for a failed implicit search,
   which can add up
 - It swallows up useful info for the first implicit search
   which caused the fallback.

The only test failing after removal was t2429.scala. That test
was originally for an issue where scalac crashed. It involves
some fairly exotic code over List[Nothing]'s. I think we can
ignore it for now, and just add the type annotation to make it
compile.
Copy link
Contributor

@DarkDimius DarkDimius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, improves both error reporting and debugging.
Would be nice to get it in soon!

@smarter smarter merged commit 7d34049 into scala:master May 23, 2017
@allanrenucci allanrenucci deleted the change-simplify-implicits branch December 14, 2017 16:58
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

Successfully merging this pull request may close these issues.

3 participants