-
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
REPL with -Ybest-effort
throws NullPointerException
#21431
Comments
We should probably remove the |
Replicable with Scala CLI / scala-cli -Ybest-effort -Ywith-best-effort-tasty
# Welcome to Scala 3.5.0 (17, Java OpenJDK 64-Bit Server VM).
# Type in expressions for evaluation. Or try :help.
scala> 1
# Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.toAbsolutePath()" because the return value of "dotty.tools.io.AbstractFile.jpath()" is null
# at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:416)
# at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
# at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
# at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
# at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
# at dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
# at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
# at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
# at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
# at dotty.tools.dotc.Run.compileUnits(Run.scala:396)
# at dotty.tools.dotc.Run.compileUnits(Run.scala:288)
# at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:88)
# at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:321)
# at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:283)
# at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:196)
# at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:199)
# at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:238)
# at dotty.tools.repl.ReplDriver.runBody$$anonfun$1(ReplDriver.scala:212)
# at dotty.tools.runner.ScalaClassLoader$.asContext(ScalaClassLoader.scala:80)
# at dotty.tools.repl.ReplDriver.runBody(ReplDriver.scala:212)
# at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:199)
# at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:136)
# at dotty.tools.repl.Main$.main(Main.scala:7)
# at dotty.tools.repl.Main.main(Main.scala) |
-Ybest-effort
throws NullPointerException
@jirijakes Hi, was there any specific intent in using the best effort compilation in repl? It was designed as an IDE feature only (which is why it has the We should still probably make the repl error out and quit gracefully when those options are used. |
Hi, @jchyb. No, no specific intent. I added it to So if the issue is me using this option in an unexpected way, then perhaps mentioning this in the aformentioned documentation would be helpful. |
Yes, for sure! Thank you for specifying where you found them, we'll update the docs to make things clearer. If you still want to try best effort compilation you can add |
Now I understand. Thanks a lot! |
Apologies for adding to this issue but is it possible that the same thing causes that worksheets do not evaluate? I use Emacs LSP. With: (setq lsp-metals-server-args '( "-J-Dmetals.enable-best-effort=false")) worksheets are evaluated as expected. No best-effort configuration in build.sbt However when best effort is enabled, the same worksheets do not evaluate anymore. I tried to repeat multiple times, cleaned the project every time and always got the same result. The only message I could find was:
Is there something else I could try to provide more information? Or is it issue rather for mdoc or metals? |
Doesn't seem like I can reproduce, but worksheet should not have betasty options enabled, so everything should work ok. If you are able to provide a reproduction we would be glad to help out. |
When calling
sbt console
on a 3.5.0 project with Best Effort Compilation enabled, the console opens but any evaluation of Scala expression ends up with NullPointerException.From stack trace, it seems to be related to dotty rather than SBT. SBT commands like
:help
work.Compiler version
Scala: 3.5.0
Java OpenJDK 64-Bit Server VM, 22.0.2
SBT: 1.10.1
Minimized code
build.sbt:
Output
The text was updated successfully, but these errors were encountered: