-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 should apply leftmost matching rule #19885
Comments
What do you think a way forward should be? Should the help message be fixed or should the behaviour change to match the help message? I feel changing the behaviour would be breaking too much. While it's not ideal the behaviour doesn't match Scala 2 IMO it shouldn't be changed at this point. |
A related potential issue is when passing multiple In a multi-module build one might want to have a base
Fortunately the above works in both Scala 2 and 3
The discrepancy is the precedence within a single So I'm not sure; I think the reason I implemented "leftmost" in Scala 2 is because left-to-right seems more natural. But then |
If two "matchers" match a warning (one rule makes it an error, the other silences), then the natural "disambiguation" is that the first matching matcher applies. It's a bit awkward to say "the last matching matcher applies". Note that there could be any number of strategies, such as "the matcher resulting in error is preferred" or "resulting in silence". Since there is a "default" configuration, the language about "prepend" (which is an internal detail) suggests "precedence". But maybe lrytz's comment is right and it's just a matter of words. I could not find discussion on old Scala 2. I don't recall without experiment that Footnote: I don't think "changing behavior" is a hindrance to fixing "bad behavior", especially since the feature is still evolving or improving in scala 3. |
I guess that's why I did leftmost in Scala 2. But one could argue that the last thing added should count, to allow overriding existing settings / defaults, that doesn't seem too awkward.
It's a necessary consequence of leftmost precedence in Scala 2.
So when calling |
Figures.
I submitted a PR to tweak |
We seem to have an emerging consensus on the Scala 2 PR that Scala 2 should align with Scala 3 on this, even though it's a breaking change. |
The
-Wconf:help
text also says the leftmost matching rule should apply.Scala 2
Scala 3
The text was updated successfully, but these errors were encountered: