-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scala 3.5.x stopped reporting generated classes via the Zinc incremental callback by default #21179
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
Comments
It's possible that this might be the commit. Look for changes to |
so the breakdown of changes: #18137 (released in 3.4.0) introduced the change that ExtractAPI phase only runs if the callback is then commit a975398 (part of pipelining, so released in 3.5.0-RC1) moved notification of non-local classes from the backend phase, to the ExtractAPI phase - which due to the change above, means non-local classes were notified only when the callback is A very simple fix would be to revert to running the ExtractAPI phase whenever the callback is merely present. Otherwise we could restore reporting in backend when incremental phases are not enabled? Or run a simplified collector in ExtractAPI to only collect classes for when we don't need incremental compile |
@vasilmkd it would be good to know the behavior you observe with Scala 2, because it also only calls |
When calling I have a test which runs some incremental compilation for many Scala versions. It only started failing when I added 3.5.0-RC1 to the mix. Here's the test for reference.
I'm now looking through Scala 2 code to verify |
Indeed, Scala 2.13 also doesn't run Let me then explain what the regression is in terms of the test expectations. |
The tests as can be seen here: https://github.com/JetBrains/intellij-scala/blob/8e8495a31a79add1fb638060b81149b2d7db42ba/scala/compiler-integration/test/org/jetbrains/plugins/scala/compiler/IncrementalCompilationTestBase.scala#L19-L33
|
org.jetbrains.plugins.scala.compiler.IncrementalCompilationTestBase#testDeleteOldTargetFilesAgain, a test project is created with the following sources: src/First.scala
class First1
class First2 src/Second.scala
class Second The project is compiled.
The source file It is asserted that only With Scala 3.5.0-RCX, |
org.jetbrains.plugins.scala.compiler.IncrementalCompilationTestBase#testDeleteTargetFilesForInvalidSourcesA test project is created with the following sources:
// src/Second.scala
class Second The project is compiled. clas First // one 's' in clas The project is incrementally compiled. It is now asserted that Here is the list of tested Scala versions:
|
If I'm allowed to speculate a bit. Maybe Scala 3 always implicitly depended on the existence of the callback in order to do reporting that Scala 2 might have been doing in the backend. Your changes made |
If scala 2.13 is not calling the Scala 3 also has the CompilerCallback which you can observe all generated classes with |
it could also depend which version of the scala 2.13 bridge sources you are compiling - I recall that pipelining was not present at 2.13.0, but added later - would be good to know if IntelliJ is using the latest source files possible - or even resolving the now published |
I'm happy to try the fix, but it would be good to verify why scala 2.13 is working when it doesn't call this method |
@vasilmkd The fix was merged and is available in 3.6.0-RC1-bin-20240716-bbb45ca-NIGHTLY |
I'm on vacation until next Tuesday, 23.07.2024. I'll see what can be done. |
I've cloned the https://github.com/JetBrains/intellij-scala and adapted it to run subclasses of
The tests execute successfully when using 3.6.0-RC1-bin-20240716-bbb45ca-NIGHTLY containing a fix. Based on that we're going to backport changes to 3.5.x. |
Thanks for checking. I also manually verified the change last week, so everything should be fine. I agree that probably it will be good to revert/actually fix this both in Scala 2 and 3. But until things are fully understood by more people, it's totally fine to not introduce behaviour changes and I don't view it as pressure. |
Compiler version
Scala 3.5.0-RC1 and above
I'm running Scala 3.5.0-RCX versions in the IntelliJ IDEA incremental compilation tests and I've noticed a change in behaviour. In IDEA, we have two modes of compilation, one using the Zinc incremental compiler, and one using the IDEA bytecode based incremental compiler.
Compiling using Zinc is not affected, because Zinc requires full analysis to run (
xsbti.AnalysisCallback#enabled
returnstrue
).When the alternative IDEA incremental compiler is used, we invoke
scalac
viasbt.internal.inc.AnalyzingCompiler
. This is where I observe the change in behaviour.All Scala versions prior to Scala 3.5.0 used to execute the
xsbti.AnalysisCallback#generatedNonLocalClass
and accompanying methods to report the production of.class
files.Judging by the previous behaviour, and the Scala 2 compiler source code, this method should be run regardless of the output of
xsbti.AnalysisCallback#enabled
. This can be seen here.Somewhere around the changes made to the Scala 3 compiler when support for
usePipelining
was developed, this changed for Scala 3.5.0.generatedNonLocalClass
is now called only ifxsbti.AnalysisCallback#enabled
istrue
.I will update this ticket as I discover more about the problem.
Tagging @bishabosha as someone who should have some context on the problem.
Thanks in advance.
The text was updated successfully, but these errors were encountered: