Skip to content
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

bugfix: Compile only existing classes #2490

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Oct 31, 2024

Previously, we would ask zinc to compile even a file that was removed and I think this was causing scalameta/metals#6478

Now, we invalidated all changed sources, but only compile new ones.

@@ -231,21 +238,22 @@ private final class BloopNameHashing(
}

def recompileClasses(
sources: Set[VirtualFile],
currentInvalidatedSources: Set[VirtualFile],
Copy link
Contributor Author

@tgodzik tgodzik Nov 1, 2024

Choose a reason for hiding this comment

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

This is the main change, we would previously send all invalidated files even if they were no longer contained in the sources. This make sense for class files to remove them, but no some much to compile new files.

With this change I was no longer able to reproduce the issue in Metals where we would get old compilation artifacts somehow.

)
}

loadBspState(workspace, projects, logger) { state =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't been able to reproduce the issue in the test unfortunately, this seems somehow connected to multiple thing being done at the same time via metals and VS Code, but the change in BloopNameHashing is sound anyway.

And having this test won't hurt

Previously, we would ask zinc to compile even a file that was removed and I think this was causing scalameta/metals#6478

Now, we invalidated all changed sources, but only compile new ones.
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

LGTM

@tgodzik tgodzik merged commit 3c7c1eb into scalacenter:main Nov 4, 2024
16 of 17 checks passed
@tgodzik tgodzik deleted the compile-existing branch November 4, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants