Aladdin - Scala Bugtracking
[#907] project: interpreter priority: high category: bug
submitter assigned to status date submitted
Martin Lex fixed 2007-01-19 14:42:15.0
subject Multi-line input on first line crashes the interpreter
code
/home/odersky/scala> scala
This is an interpreter for Scala.
Type in expressions to have them evaluated.
Type :help for more information.

scala> def foo = {
     |   1+2
     | }
line0: scala.Int = 0
foo: => scala.Int

scala> def bar = {
     | foo + foo
     | }
bar: => scala.Int

scala> def baz = {
     | bar + bar
     | }
baz: => scala.Int

scala> baz
what happened
java.lang.NoSuchMethodError: line0$object$.foo()I
	at line1$object$.bar(:6)
	at line2$object$.baz(:6)
	at line3$object$.(:5)
	at line3$object$.()
	at RequestResult$line3$object$.(:3)
	at RequestResult$line3$object$.()
	at RequestResult$line3$object.result()
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at scala.tools.nsc.Interpreter$Request.loadAndRun(Interpreter.scala:565)
	at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:287)
	at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:219)
	at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:206)
	at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:112)
	at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:255)
	at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:90)
	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

scala> 
what expected The first line looks funny. This bug needs to be fixed before a release, I think.
[back to overview]
Changes of this bug report
Lex  edited on  2007-01-19 14:57:23.0

Stephane reported this problem informally already. I believe this bug is fixed, but if you see it again please re-open the bug.

The problem was that the interpreter now primes itself by doing an evaluation of "0". Erroneously, it used to reuse the "line0" object wrapper. Now it should use "line_neg1" and thus avoid the conflict.