Skip to content

@unused ignored when compiler option -Wunused:explicits/-Wunused:params is set #23122

Closed as duplicate of#23033
@aartigao

Description

@aartigao

Compiler version

3.7.0

Minimized code

https://scastie.scala-lang.org/AcRqBnMOQvGVKyMGrNS7FQ

import scala.annotation.unused

@main def hello(): Unit =
  println(A(""))

class A(@unused param: AnyRef)

Output

-- [E198] Unused Symbol Warning
  |class A(@unused param: AnyRef)
  |                ^^^^^
  |                unused explicit parameter

Expectation

No warn emitted as the annotation should be taken into account.

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