Skip to content

REPL crashes when using :type or :doc command without any parameter #9538

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
JackyWangMislantiaJnirvana opened this issue Aug 12, 2020 · 0 comments

Comments

@JackyWangMislantiaJnirvana
Copy link

JackyWangMislantiaJnirvana commented Aug 12, 2020

Minimized code

scala> :type
// or
scala> :doc

Output (click arrow to expand)

REPL crashes after executing such line

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
	at dotty.tools.dotc.util.SourceFile.lineToOffset(SourceFile.scala:124)
	at dotty.tools.dotc.util.SourcePosition.lineOffsets$$anonfun$1(SourcePosition.scala:40)
	at dotty.runtime.function.JFunction1$mcII$sp.apply(JFunction1$mcII$sp.java:12)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.util.SourcePosition.lineOffsets(SourcePosition.scala:40)
	at dotty.tools.dotc.util.SourcePosition.beforeAndAfterPoint(SourcePosition.scala:43)
	at dotty.tools.dotc.reporting.MessageRendering.sourceLines(MessageRendering.scala:71)
	at dotty.tools.dotc.reporting.MessageRendering.sourceLines$(MessageRendering.scala:18)
	at dotty.tools.repl.Rendering$$anon$1.sourceLines(Rendering.scala:35)
	at dotty.tools.dotc.reporting.MessageRendering.messageAndPos(MessageRendering.scala:152)
	at dotty.tools.dotc.reporting.MessageRendering.messageAndPos$(MessageRendering.scala:18)
	at dotty.tools.repl.Rendering$$anon$1.messageAndPos(Rendering.scala:35)
	at dotty.tools.repl.Rendering.formatError$$anonfun$1(Rendering.scala:100)
	at dotty.tools.dotc.reporting.NoExplanation.msg(Message.scala:120)
	at dotty.tools.dotc.reporting.NoExplanation.toString(Message.scala:124)
	at java.lang.String.valueOf(String.java:2994)
	at java.io.PrintStream.println(PrintStream.java:821)
	at dotty.tools.repl.ReplDriver.displayErrors$$anonfun$3(ReplDriver.scala:399)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.repl.ReplDriver.displayErrors(ReplDriver.scala:399)
	at dotty.tools.repl.ReplDriver.interpretCommand$$anonfun$2(ReplDriver.scala:380)
	at scala.util.Either.fold(Either.scala:190)
	at dotty.tools.repl.ReplDriver.interpretCommand(ReplDriver.scala:381)
	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:203)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:129)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:132)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:151)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:132)
	at dotty.tools.repl.Main$.main(Main.scala:6)
	at dotty.tools.repl.Main.main(Main.scala)
december32 added a commit to december32/scala3 that referenced this issue Aug 16, 2020
december32 added a commit to december32/scala3 that referenced this issue Aug 16, 2020
liufengyun added a commit that referenced this issue Aug 17, 2020
Fix #9538: repl crashes when :type and :doc are invoked with an empty expression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants