Skip to content

Ensure lint warnings are configurable via nowarn #18653

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

Closed
som-snytt opened this issue Oct 5, 2023 · 2 comments
Closed

Ensure lint warnings are configurable via nowarn #18653

som-snytt opened this issue Oct 5, 2023 · 2 comments
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc exp:intermediate itype:enhancement

Comments

@som-snytt
Copy link
Contributor

Compiler version

3.3.x

Minimized code

  @nowarn("msg=unused")
  private def summonImpl[A: Type](using Quotes): Expr[This[A]] =
    import quotes.*
    import quotes.reflect.{This as ThisTerm, *}
    ...

Output

False positive under -Wunused:imports must be suppressed as shown.

Expectation

The false positive on the renamed import can be silenced by local @nowarn, but requires using a brittle string.

Even if the message is unusually stable ("unused import"), discovering and copy/pasting strings is an unhealthy workflow.

Parity with Scala 2 would require categories for lints cat=lint-unused-import of some granularity, or possibly dotty message ids id=W100. "Awesome warnings!"

In addition, top-level imports can't be annotated, so Scala 2 uses origin=quotes.reflect.This.

If warnings are easy to silence, then they are easy to enable.

There is a discussion about the need for further parity in -Wconf at #17635

This problem came up on discord via Alexandru Nedelcu Today at 11:47 AM

@som-snytt som-snytt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 5, 2023
@bishabosha bishabosha added itype:enhancement area:reporting Error reporting including formatting, implicit suggestions, etc and removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 6, 2023
@bishabosha bishabosha changed the title Lints must be reasonably silenceable Ensure lint warnings are configurable via nowarn Oct 6, 2023
@mbovel mbovel added exp:intermediate Spree Suitable for a future Spree labels Feb 19, 2024
@mbovel mbovel removed the Spree Suitable for a future Spree label Sep 23, 2024
@som-snytt
Copy link
Contributor Author

Related to #18341

@som-snytt
Copy link
Contributor Author

The linked PR adds origin, and the linked issue was a bug in registering nowarn. Nothing to see here!

Dotty categories are not as rich, but unused is id 198.

@som-snytt som-snytt closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc exp:intermediate itype:enhancement
Projects
None yet
Development

No branches or pull requests

3 participants