Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning is not suppressed after error despite -Wconf #12587

Closed
som-snytt opened this issue May 5, 2022 · 4 comments
Closed

Warning is not suppressed after error despite -Wconf #12587

som-snytt opened this issue May 5, 2022 · 4 comments

Comments

@som-snytt
Copy link

Reproduction steps

Scala version: 2.13.8

[error] ...scala/test/junit/scala/collection/convert/MapWrapperTest.scala:90:1: '=' expected.
[error]       def run(): Unit = {
[error] ^
[warn] ...scala/test/junit/scala/tools/nsc/async/AnnotationDrivenAsyncTest.scala:418:29: early initializers are deprecated; they will be replaced by trait parameters in 3.0, see the migration guide on avoiding var/val in traits.
[warn]         object late extends {
[warn]                             ^
[warn] one warning found
[error] one error found

Problem

The warning is suppressed by configuration, but if there is an error (as shown, for example), the warning is emitted.

Now I'm not sure I didn't add suppressions because of this behavior, even though suppressions were already configured.

(It's also unfortunate that the error report is "old school", reporting on the innocent line because that is when the parser noticed it, instead of on the guilty line.)

@lrytz
Copy link
Member

lrytz commented May 10, 2022

This rings a bell, I think I noticed this issue when working on the Scala 3 port, but then dropped the ball I guess...

@som-snytt
Copy link
Author

This partest only errors, so it is more subtle.

// scalac: "-Wconf:cat=deprecation&msg=early initializers:s"

object X extends { val x = 42 } with Runnable {
  @volatile var done
  def run() = println(x)
}

@som-snytt
Copy link
Author

Actually build.sbt selectively applies silencing early definitions, and it does not apply to junit subproject.

The test has a nowarn, but the error is issued by parser, so I'm guessing the warnings are flushed without seeing the inline suppression.

OK, runFinished says // report suspended messages (in case the run finished before typer). global always notifies that the run is done. Then it summarizeErrors.

Normally, typer will runReporting.reportSuspendedMessages(unit) when done.

Why doesn't my partest show the reported behavior? Because the default Wconf is

private val WconfDefault = List("cat=deprecation:ws", "cat=feature:ws", "cat=optimizer:ws")

so the deprecation is only summarized. Does that imply that partest compilation does not summarize? No, summarizeErrors [sic] only summarizes warnings if !hasErrors.

So why does the junit compile show the warning?

"-Xlint:-valpattern,_",

turns on deprecation and also sets -Wconf:cat=deprecation:w.

@som-snytt som-snytt closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
@som-snytt
Copy link
Author

#12984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants