-
Notifications
You must be signed in to change notification settings - Fork 337
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
Best effort compilation gives false errors #6628
Comments
Thanks for reporting! I wonder if this might be connected to the fact that we now compile all modules and sometimes this might lead to worse errors in the dependent modules. Best effort itself will not produce any new diagnostics. |
I can confirm the same behaviour in my project. 👍 In fact, it also appears that even if I make the code compile successfully again (as confirmed by the SBT build), but not by reverting the file to the initial state (e.g. with undo), but by further modifying the implementation to fix it, then the bogus error diagnostics are still visible. 🤔 To add additional data point: I just had a case where I got weird (and incorrect) error diagnostics shown in the edited file (some imported types suddenly cannot be found), even though my changes did compile successfully from the get go, build was not broken at any point, I have only removed an unused implicit definition (although I did get an unused import warning from the compiler in the SBT afterwards if that matters, albeit I have no Scala 3.5.0-RC6, Bloop 1.6.0, SBT 1.10.1, Metals 1.3.4+23-c744a47f-SNAPSHOT |
One more update (sorry for a lot of messages, but I hope it will be useful info for you): while usually SBT build gives expected results (either a successful compilation or an error that is real and makes sense), I have regularly observed that after a while (of Metals compiling the project due to the editor changes) SBT seems to deteriorate as well and starts spewing weird messages (cannot find imports/types, broken build). After a clean build it starts working again and is good for some time. 🙁 At this point Metals is almost unusable for me with a Scala 3.5 project. @tgodzik Is there any way to disable the Best Effort Compilation for the time being? 😕 |
We might have to add a setting for that if it turns out to be the problem, but I can't imagine why would this happen. I will check it out today. |
I will have to disable it, thanks for catching this before the actual release of 3.5.0! I will have to do a new release with this probably tomorrow. @jchyb is on vacation till 16th, and I think I will have to ask him to take a look again. @brndt is it ok if I share your codebase with him once he's available? |
Yes of course. |
wondering if there is any update? with the release of 3.5 tried to enable best effort compiling on |
Still working on this. It looks like the issue is moreso on the build server side, so the best effort compilation should still work on 3.5 once we fix this issue. |
@jchyb Thank you for looking into this. 👍 Just in case, a related issue #6627 caused by the Best Effort compilation was closed earlier, but that one seems to be somewhat distinct, as it impacts macros specifically (seemingly in the test scope only), even in a completely clean project build with no other errors. I have no idea if the root cause is the same, but wanted to highlight it, as it might have got lost in the meantime. 🙂 |
Can confirm that this issue persists in metals 1.3.5 with Scala 3.5.0 when enabling best effort compilation with From what I gathered, there's only one type of error—"value foo is not a member of bar"—and is triggered only for the imports. Hope this helps to track it down. |
One issue still existing (not sure if caused by best effort) :
|
My guess is that we don't remove early compilation in the client dir, but not sure if that is the only issue. |
To be honest, I cannot reproduce this issue anymore with:
|
The main issue reported here got fixed in bloop v2.0.4. Depending on the dependency graph between files, and which files we recompile, it might not even show in earlier versions, even when |
Describe the bug
If I make any changes in the code and break compilation, the compiler gives random totally non-related errors.
For example:
be_test.mov
Expected behavior
No response
Operating system
macOS
Editor/Extension
VS Code
Version of Metals
1.3.4
Extra context or search terms
No response
The text was updated successfully, but these errors were encountered: