Skip to content

No warn for evidence params of marker traits such as NotGiven #22985

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

Fixes #22969

@som-snytt
Copy link
Contributor Author

The test shows I'd made the opposite choice previously:

trait Context[A]
trait Implicits {
  def f[A](implicit ctx: Context[A]) = answer // warn implicit param even though only marker
  def g[A: Context] = answer // no warn bound that is marker only
}
class Bound[A: Context] // no warn bound that is marker only

Possibly that was intended for implicit but not using parameters. It's better not to special-case "old-style" implicit, especially since the consequence would be to "underwarn".

@som-snytt som-snytt force-pushed the issue/22969-notgiven-unused branch from 2c90e60 to fa800a6 Compare April 12, 2025 12:47
@som-snytt som-snytt force-pushed the issue/22969-notgiven-unused branch from fa800a6 to 32defdf Compare April 12, 2025 12:47
@odersky
Copy link
Contributor

odersky commented Apr 14, 2025

I am not sure how much it's worth to run down the rabbit hole with this. The proper way to handle this is to use erased. erased implicit parameters should not need to be used. In fact, they can't be used except as arguments to other erased parameters.

erased is still experimental. This goes to show that the language proper moves a lot slower than annotations since annnotations currently don't require SIPs. But that should not be a reason to push everything into annotations now.

@som-snytt
Copy link
Contributor Author

I forgot about erased. These "mitigations" try to "guess user intentions" that aren't expressed directly in the language.

@som-snytt som-snytt marked this pull request as ready for review April 15, 2025 01:27
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.

Unused warning for NotGiven is not useful
2 participants