-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enabling coverage breaks synchronized
blocks
#16940
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
Labels
Comments
KacperFKorban
referenced
this issue
in dotty-staging/dotty
Feb 17, 2023
possible fix for lampepfl#16940
KacperFKorban
referenced
this issue
in dotty-staging/dotty
Feb 17, 2023
possible fix for lampepfl#16940
I have a similar problem. I get an val lockedFiles: mutable.Set[String] = mutable.Set.empty
val path = "file.txt"
def submit() =
lockedFiles.synchronized {
while lockedFiles.contains(path) do lockedFiles.wait()
lockedFiles += path
}
// do stuff Looking at the bytecode it seems to represent something more like this: val lockedFiles: mutable.Set[String] = mutable.Set.empty
val path = "file.txt"
def submit() =
while lockedFiles.contains(path) do lockedFiles.wait()
lockedFiles += path
lockedFiles.synchronized {}
// do stuff The synchronized block has been moved to the end! I use Scala 3.3.0, but have checked that it's also broken on 3.3.1-RC4. |
KacperFKorban
referenced
this issue
in dotty-staging/dotty
Aug 18, 2023
possible fix for lampepfl#16940
fixed in #16941 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Compiler version
3.2.2
Minimized code
https://github.com/mohe2015/coverage-synchronized-bug
scala -coverage-out coverage src/main/scala/Main.scala
Output
Expectation
The text was updated successfully, but these errors were encountered: