-
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
Changes to -Xfatal-warnings
lead to a UX regression in Scala tooling
#20041
Comments
We could try to set the source position to the start of the file that had the warnings |
I would say that this ticket should be marked as a blocker and Scala 3.4.1 should not be released without a clear resolution to this ticket. I don't mind whatever decision is reached, as long as there are clear action points that all tooling will collectively take on this matter. That's what I'm hoping this discussion will help bring. Currently, the compiler is presenting a clear regression compared to previous releases and it will be a burden on the tooling maintainers to work around and explain the situation to confused users. |
A first step would be to use the name The scalac help says:
The javac help says:
The scalac help also says:
The The options serve different purposes.
|
Honestly, I'm very surprised that under the original ticket, there was not a new level of message added (potentially transparently to the end user) to split ERRORs where we can keep going somewhat, and ERRORs where a firm stop is needed. |
@vasilmkd Hey, so this change was intentional on our side. It's also intentional for it to land in 3.4.1, no minor version bump is necessary, it doesn't break any compatibility guarantees. It's an internal API behaviour change, so it shouldn't be considered as a regression. Changes on the tooling side of things will be required. I suppose we could have communicated it stronger, however the 3.4.1-RC1 & 3.4.1-RC2 have been out for a while now, available to be tested with tooling.
The 3.4.1 release process is tracked in here:
There could be more changes similar to this one in future versions, including patch versions. We will try to communicate them better, and also they should be available to test with tooling via the RC versions. Generally speaking, any such change is available for testing at least 1 month before a release happen. Now, as for the changes required on the tooling side. Manually upgrading warnings to errors as you have suggested is definitely one of the possible solutions. I am not sure if it'll be the optimal course of action, it needs to be judged case by case. Every tool might want to do it differently. The current behaviour is especially useful for terminal-based tools (i.e. sbt), because it clearly distinguishes warnings from errors, as they are treated as different entities even with |
@Gedochao thanks for clearing things up. We will manually promote the warnings to errors in IntelliJ IDEA. I suppose that other tooling will do the same. I'm personally satisfied with that outcome, as I had indicated in my comment. I no longer consider this a blocker. |
AFAIK the best public place describing compiler options behaviour is If so, it will require clarifications for 3.4.x as it states
and not
|
@Gedochao
Have you considered changing the compiler in a way that it does not crash on some errors? |
To be completely clear, I welcome the change and think that aggregating all warnings to issue together is a great improvement. I'm just not at all convinced that leaving the warnings as warnings, and issuing an obscure message at the end, just to satisfy a requirement that the compilation finishes with an error is good UX, regardless of which tool will consume the messages. It is clearly confusing in the presence of I would be very interested to hear arguments for keeping the warnings as warnings, and not promoting them to errors. |
The documentation I see states that: val XfatalWarnings: Setting[Boolean] = BooleanSetting(WarningSetting, "-Werror", "Fail the compilation if there are any warnings.", aliases = List("-Xfatal-warnings")) As I see it, it does exactly the thing. It states nothing about promoting warnings to errors. But that is not the point. I have one argument that may or may not convince you: In sbt shell, it is all working together, as you can see the If we consider it from the IDE perspective, thou it may be a bit problematic. I see 3 ways as of today on how they can display them in "Problems" tab:
I see the 3rd option as best one but the problem is, where to put this error ? |
Your argument is very reasonable. As I said, it is a precedent to no longer promote errors. I'm not making a judgement on whether this is a good or a bad thing. I'm sorry I had a wrong notion of the
This is what happens in the IDEA build window too. My concerns are more around the presentation in the editor itself. I would like all tooling to be consistent here, and why I raised the discussion in the first place. With the Bloop vs sbt inconsistency in Metals, I could easily see a confusion arising with people using one build server and reporting an issue, and the maintainers having trouble reproducing the issue because the project/tooling config has not been fully specified in the report. It happens all the time with user reports in IDEA. |
Seems like the core concerns have been addressed. |
@Gedochao Please take a look at my seemingly-missed comment The page requires a simple patch, updating the -Werror description, just to avoid any potential confusion in future |
This ticket is a follow up UX report/discussion following the changes in
#18634
and specifically, #19245 (this is the final PR, but the other PRs are relevant as well).
Compiler version
3.4.1-RC1 and above
Minimized code
Necessary compiler flags
scalac -Xfatal-warnings -Wunused:locals
Output Scala 3.3.3
Output Scala 3.4.1-RC2
Screenshots from Metals
-Xfatal-warnings
(but not-Werror
, separate issue):No warnings can be incurred under -Werror (or -Xfatal-warnings)
error message is not reported anywhere. I believe this is due to this error message being issued without any source and position information.Discussion (originally posted in a Scala Center - VirtusLab - JetBrains collaboration channel, copied almost verbatim)
Let’s examine the
-Xfatal-warnings/-Werror
change at a high level. We used to have compiler messages that could be treated as self-contained pieces of compilation information. This was achieved through thexsbti.Problem
interface, which contains all info that we might need to present a compiler issued message, be it in a build tool, or an editor.With this latest change, a precedent has been set, each
xsbti.Problem
is no longer self-contained. Instead, multiplexsbti.Problem
instances are part of a larger context, and need to be evaluated together, in order to decide whether anxsbti.Problem
needs to be modified after the fact.And we already have inconsistencies because of this. Sbt (in the terminal) shows warnings and a single error at the end, just like the compiler issues the messages (i.e. does no further post processing). When using Metals with sbt, this is what the user will see as well (without the
No warnings can be incurred
error message, whose absence makes things more confusing). From a user experience perspective, this is a regression. Scala 3.3 with-Xfatal-warnings
issues errors, and Scala 3.4 with the same-Xfatal-warnings
issues warnings, so the user will start seeing warning highlights in the editor, where they used to see error highlights prior to updating the Scala version. This will seem surprising to users, thinking that-Xfatal-warnings
is ignored.The same is happening in IntelliJ IDEA as well, when using the compiler for error highlighting.
On the other hand, Bloop manually upgrades the warnings into errors. This has been confirmed by @tgodzik , and is an old feature of Bloop. I'm glad it exists and I'm using it as an illustration of UX inconsistencies in Scala tooling, in the hopes of converging on a consistent presentation to users.
What I would like to discuss is, given that this precedent has been set, how do we converge on a consistent UX across the tools and editors. And given that there are intentions to make Scala 3.4 even more resilient in the face of compilation errors, will this be the only case of “manually upgrading warnings to errors”, or will there be other, different combinations of messages where we need to do post processing on the compiler messages.
I’m tagging @szymon-rd and @nicolasstucki as the people who were directly involved in the implementation and review of this change, but anyone else is more than welcome to join the discussion.
Thanks in advance.
The text was updated successfully, but these errors were encountered: