scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Diagnostics are silently suppressed #13057

Open som-snytt opened 3 weeks ago

som-snytt commented 3 weeks ago

Reproduction steps

Scala version: 2.13.15

If a diagnostic is suppressed for any reason, it is suppressed without notice.

There is no mechanism for auditing suppression.

There are many subtle mechanisms of suppression: -Wconf, -nowarn, @nowarn, : Unit, @unchecked.

Diagnostics may be hidden if at the same position. (-Xdev -Vdebug to make that verbose?)

The inline mechanisms are especially dangerous, since it is unthinkable to "comment them out".

It would be nice if suppressions could be summarized by a count, or verbosely listed for a detailed audit.

Problem

If an expected diagnostic doesn't show up in a build, you have to be Stefan Zeiger to figure out why.

som-snytt commented 2 weeks ago

Relates to https://github.com/scala/bug/issues/11631

som-snytt commented 2 weeks ago

example

  @nowarn("msg=shadowing a nested class of a parent is deprecated")
  @deprecated("use InternalTreePrinter instead", since = "2.13.4")
  class TreePrinter(out: PrintWriter) extends super.TreePrinter {

Why is it necessary to nowarn a deprecation in a deprecated program element?

I would like to answer that question without debugging the moving parts of reporting.

(And maybe the nowarn was for historical reasons.)