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

-Wconf and @nowarn do not support origin filter #17538

Closed
nicolasstucki opened this issue May 19, 2023 · 3 comments · Fixed by #21404
Closed

-Wconf and @nowarn do not support origin filter #17538

nicolasstucki opened this issue May 19, 2023 · 3 comments · Fixed by #21404
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc help wanted itype:bug
Milestone

Comments

@nicolasstucki
Copy link
Contributor

nicolasstucki commented May 19, 2023

Compiler version

3.3.0-RC4

Minimized code

import scala.collection.Map
import scala.annotation.nowarn

trait MyMap[K, +V] extends Map[K, V] {
  @nowarn("""cat=deprecation&origin=scala\.collection\.Iterable\.stringPrefix""")
  override protected[this] def stringPrefix: String = "MyMap"
}

Output

-- Warning: t/Test.scala:5:10 --------------------------------------------------
5 |  @nowarn("""cat=deprecation&origin=scala\.collection\.Iterable\.stringPrefix""")
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |          Invalid message filter
  |          unknown filter: origin
-- Deprecation Warning: t/Test.scala:6:31 --------------------------------------
6 |  override protected[this] def stringPrefix: String = "MyMap"
  |                               ^
  |overriding method stringPrefix in trait Iterable of type => String is deprecated;
  |  method stringPrefix of type => String should be removed or renamed.```

Expectation

Should compile without waninings

@nicolasstucki nicolasstucki added itype:bug area:reporting Error reporting including formatting, implicit suggestions, etc labels May 19, 2023
@SethTisue SethTisue changed the title @nowarn does not support origin filter -Wconf and @nowarn do not support origin filter Jan 31, 2024
@som-snytt
Copy link
Contributor

More complaining at #19582 with link to chat where it was needed.

@hamnis
Copy link

hamnis commented Aug 15, 2024

Scala 2.13 makes ignoring expected unused imports possible since we can use -Wconf:origin like described here: https://github.com/scala/scala-collection-compat?tab=readme-ov-file#fixing-unused-import-warnings

It would be really great if this could be ported to scala 3.3, so more of the community can turn on -WError

@som-snytt
Copy link
Contributor

The PR does deprecations but not yet import warnings; I'll do that after the CheckUnused refactor is accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc help wanted itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants