scala / bug

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

Error messages should include deprecation status of symbol #12730

Open som-snytt opened 1 year ago

som-snytt commented 1 year ago

Reproduction steps

Scala version: every version

scala> 42.formatted("%d")
          ^
       warning: method formatted in class StringFormat is deprecated (since 2.12.16): Use `formatString.format(value)` instead of `value.formatted(formatString)`,
       or use the `f""` string interpolator. In Java 15 and later, `formatted` resolves to the new method in String which has reversed parameters.
val res0: String = 42

scala> 42.formatted()
                   ^
       error: not enough arguments for method formatted: (fmtstr: String): String.
       Unspecified value parameter fmtstr.

Problem

Although the general rule is to show errors first and then warnings, on the assumption that errors cascade in spurious warnings, even though warnings may reveal what leads to the error, the descriptive text for a symbol in an error message should include whether it is deprecated.

Possibly it is required only when -deprecation is enabled.