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

Warn if implicit underscore is no-op #11618

Open
som-snytt opened this issue Jul 8, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@som-snytt
Copy link

commented Jul 8, 2019

Please warn on:

implicit val _ = 42
implicitly[Int]

Normally, an extractor pattern would either fail or implicit is available.

scala> object X { def unapply(s: String) = Option(s.tail) }
defined object X

scala> val X(s) = "hello"
s: String = ello

scala> val X(_) = "hello"

scala> implicit val X(_) = "hello"

scala> implicitly[String]
                 ^
       error: could not find implicit value for parameter e: String

#10384

@som-snytt

This comment has been minimized.

Copy link
Author

commented Jul 8, 2019

Oh wait, I meant to say: warn if implicit doesn't actually introduce a binding. Sorry, this isn't my day job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.