Content-Length: 339775 | pFad | https://github.com/scala/scala/pull/10750

FF Fix `-Wconf` and `-nowarn` to be more consistent by som-snytt · Pull Request #10750 · scala/scala · GitHub
Skip to content

Fix -Wconf and -nowarn to be more consistent #10750

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

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Apr 10, 2024

Always respect user -Wconf settings, including -nowarn. Previously, some defaults were incorrectly enforced.

For example,
-Wconf:cat=deprecation:e -deprecation -nowarn
would fail to issue an error on deprecation, but now correctly works the same as
-deprecation -nowarn -Wconf:cat=deprecation:e

-nowarn sets -Xmaxwarns:0 (which limits how many warnings are displayed) and also suppresses the "summary" messages that report a summary count, as well as suppressing the error under -Werror ("No warnings can be incurred"). It adds any:s to suppress any other warnings, and turns off cat=scala3-migration:e that boosts migration errors under -Xsource:3.

Fixes scala/bug#12984
Fixes scala/bug#12664

Instead of adding wconf for deprecation when setting is selected, adjust the default filter when processing the configuration. This ensures that user config is respected in this respect.

Otherwise, subtle order dependency is not friendly.

Besides setting maxwarns, nowarn is a trailing -Wconf:any:s. That is, any unconfigured warnings are silenced. Configured warnings are counted and reported in the usual way, but summaries are silenced under -nowarn.

@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Apr 10, 2024
@som-snytt som-snytt force-pushed the issue/12984-wconf-deprecation branch from 801b298 to 820ad16 Compare April 11, 2024 01:19
@som-snytt
Copy link
Contributor Author

som-snytt commented Apr 11, 2024

Somewhere in the -Wconf PR, there was a "reset setByUser", a facility I needed for the test (WConfTest.default).

Reporting adjusts the deprecation conf depending on deprecation.isSetByUser.

Note: revisit reset impls

@som-snytt som-snytt force-pushed the issue/12984-wconf-deprecation branch 3 times, most recently from ce202a3 to 7da120c Compare May 9, 2024 18:54
@som-snytt som-snytt requested a review from lrytz June 21, 2024 04:57
@SethTisue
Copy link
Member

@som-snytt if I'm a Scala user hurriedly/impatiently reading the 2.13.15 release notes, what is the upshot of this change for me...?

@som-snytt som-snytt changed the title Adjust deprecation config after Wconf User Wconf is respected by default behavior such as summary of deprecations Jul 18, 2024
@SethTisue

This comment was marked as resolved.

@som-snytt som-snytt force-pushed the issue/12984-wconf-deprecation branch from 7da120c to 2e0c786 Compare August 8, 2024 01:00
@lrytz
Copy link
Member

lrytz commented Aug 14, 2024

Instead of setting maxwarn, nowarn is a trailing -Wconf:any:s.

In the current form it's both (which is the right thing), not "instead".

@som-snytt som-snytt changed the title User Wconf is respected by default behavior such as summary of deprecations -Wconf and -nowarn are more consistent Aug 14, 2024
@som-snytt
Copy link
Contributor Author

@lrytz thanks again for the care you take. I reviewed the changes again and updated the text.

@som-snytt som-snytt merged commit d9a9637 into scala:2.13.x Aug 14, 2024
4 checks passed
@som-snytt som-snytt deleted the issue/12984-wconf-deprecation branch August 14, 2024 13:37
if (needsDefaultAdjustment || settings.nowarn.value) {
val (user, defaults) = conf.filters.splitAt(conf.filters.length - settings.WconfDefault.length)
val Deprecation = MessageFilter.Category(WarningCategory.Deprecation)
val action = if (settings.deprecation.value) Action.Warning else Action.Silent
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth following up whether -deprecation -nowarn does the obvious thing (whatever that is). With a custom reporter, there could be a difference between "what is displayed" and "warnings that reach the reporter"?

@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Aug 14, 2024
@SethTisue SethTisue changed the title -Wconf and -nowarn are more consistent Fix -Wconf and -nowarn to be more consistent Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-Wconf can depend on order of other args, such as -deprecation Reporter counts warnings when -nowarn is enabled
4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/scala/scala/pull/10750

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy