-
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
Async code access to a variable in App fails in Dotty #16149
Comments
maybe scala/scala#10070 hasn't propagated to Scala 3 yet? it was included in Scala 2.13.9: https://www.scala-lang.org/api/2.13.9/scala/App.html (it's a bit peculiar that you linked to the 2.13.3 doc above; that's a quite old version) |
2.13.3 is when |
There are many Scala 2 tickets about deadlocking a class initializer (object). From pandemic era: There is a comment on that ticket about differences in dotty. |
Yes, I think the dotty documentation of |
Two small notes and two suggestions...
While it would be very helpful if scala/scala#10070 changes were present in dotty's docs, I don't think it will necessarily prevent people from wasting time on writing and debugging the kind of code that I demonstrated. Even if you carefully read the whole thing (which not many people do tbh), you may still think that it's OK to use Is there a reason not to make the trait deprecated already? |
That should be resolved in 3.2.1 by #16074 |
Compiler version
3.2.0
Minimized code
Output
Expectation
I'm aware of the intricacies of
DelayedInit
andApp
. However, since this works in Scala 2.13, I would expect this to also work in Scala 3 because the doc hasn't change: doc dotty, doc 2.13.3.Moreover, looking at this statement:
it's not clear why wrapping code into a Future makes any difference. Isn't access to
test
on line 3 happening before the method has been executed? 🤔The text was updated successfully, but these errors were encountered: