Skip to content

Ensure lint warnings are configurable via nowarn #18653

Closed as not planned
Closed as not planned
@som-snytt

Description

@som-snytt

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions