-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compiler plugins cause REPL to crash #18381
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
nice catch. compared to Scala 2, I think Scala 3 compiler plugins in are in much less wide use, so I'm not too surprised that something quite basic like this is broken (but it's dismaying nonetheless, of course) |
I'll take a quick look. At a glance, maybe the Run re-adds the plugin when the Context is built. |
I took a look, and Scala 3 expects to instantiate phase objects per Run. The example incorrectly supplies the same phase object in
There is no trivial means to subvert this requirement (by overriding behavior). Not closing in case there is documentation follow-up. |
Oooh, very good to know, thank you @som-snytt! |
@mrdziuban was your sample plugin code copied from some upstream source where the bug could be corrected? I am the author of (closed source) Scala 3 compiler plugin and I see that my plugin has this bug, so I'm glad to learn of it, thanks. I see no indication of the requirement in the Scaladoc of |
Yeah I maintain a couple open source plugins at work, I just updated both of them a bit ago |
doc PR: #18394 |
Compiler version
3.3.0, also with the latest 3.3.1-RC4 and nightly 3.4.0-RC1-bin-20230809-c5adafc-NIGHTLY
Minimized code
https://github.com/mrdziuban/dotty-compiler-plugin-issue
After cloning that repo and running
sbt package
, you can reproduce the issue by runningscala
with the plugin:and then by evaluating two statements:
Output
When evaluating the second statement, the REPL crashes:
Expectation
The REPL should handle compiler plugins and not crash
The text was updated successfully, but these errors were encountered: