Skip to content

multiple @nowarn annotation does not work since Scala 3.7.0 #23651

@xuwei-k

Description

@xuwei-k

Compiler version

  • 3.7.0
  • 3.7.1
  • 3.7.2
  • 3.8.0-RC1-bin-20250731-fe6b7eb-NIGHTLY

Minimized code

//> using scala 3.7.2
//> using options -deprecation

package example

import scala.annotation.nowarn

@deprecated
class A

@deprecated
class B

@nowarn("msg=class A in package example is deprecated")
@nowarn("msg=class B in package example is deprecated")
trait C1 {
  def a: A
  def b: B
}

@nowarn("msg=class B in package example is deprecated")
@nowarn("msg=class A in package example is deprecated")
trait C2 {
  def a: A
  def b: B
}

Output

[warn] ./A.scala:18:10
[warn] class B in package example is deprecated
[warn]   def b: B
[warn]          ^
[warn] ./A.scala:24:10
[warn] class A in package example is deprecated
[warn]   def a: A
[warn]          ^

Expectation

suppress all warnings. but compiler report warnings. secondary @nowarn annotation does not work.

note

suppress all warnings with Scala 3.3.6, 3.4.3, 3.5.2, 3.6.4

Metadata

Metadata

Assignees

Labels

better-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:bugregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions