Skip to content

REPL crashes on val _ = ??? #14701

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

Closed
griggt opened this issue Mar 16, 2022 · 0 comments · Fixed by #14702
Closed

REPL crashes on val _ = ??? #14701

griggt opened this issue Mar 16, 2022 · 0 comments · Fixed by #14702
Assignees
Milestone

Comments

@griggt
Copy link
Contributor

griggt commented Mar 16, 2022

Compiler version

3.1.2-RC2

Minimized code

scala> val _ = ???

Output

scala> val _ = ???
Exception in thread "main" scala.NotImplementedError: an implementation is missing
	at scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
	at rs$line$1$.<clinit>(rs$line$1:1)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at dotty.tools.repl.Rendering.load$1(Rendering.scala:147)
	at dotty.tools.repl.Rendering.forceModule(Rendering.scala:149)
	at dotty.tools.repl.ReplDriver.extractAndFormatMembers$1(ReplDriver.scala:337)
	at dotty.tools.repl.ReplDriver.renderDefinitions$$anonfun$2(ReplDriver.scala:358)
	at scala.Option.map(Option.scala:242)
	at dotty.tools.repl.ReplDriver.renderDefinitions(ReplDriver.scala:361)
	at dotty.tools.repl.ReplDriver.compile$$anonfun$2(ReplDriver.scala:280)
	at scala.util.Either.fold(Either.scala:189)
	at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:296)
	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:230)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:162)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:165)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:186)
	at dotty.tools.repl.ReplDriver.runBody$$anonfun$1(ReplDriver.scala:174)
	at dotty.tools.runner.ScalaClassLoader$.asContext(ScalaClassLoader.scala:80)
	at dotty.tools.repl.ReplDriver.runBody(ReplDriver.scala:174)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:165)
	at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:127)
	at dotty.tools.repl.Main$.main(Main.scala:6)
	at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:192)
	at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:267)
	at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)

Expectation

Should render the error message, but not crash.

scala> val _ = ???
scala.NotImplementedError: an implementation is missing
  at scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
  ... 57 elided

Notes

Occurs whenever the RHS throws any non-fatal subclass of j.l.Error, e.g. val _ = assert(false) also crashes.

@griggt griggt self-assigned this Mar 16, 2022
griggt added a commit to griggt/dotty that referenced this issue Mar 16, 2022
…???`

The REPL should not crash when the right hand side of `val _ =`
throws a non-fatal error that is a subclass of java.lang.Error.
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants