Skip to content
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

"val x: Array[Double] = ...; x(0) = ???" kills the compiler #8414

Closed
scabug opened this issue Mar 15, 2014 · 2 comments
Closed

"val x: Array[Double] = ...; x(0) = ???" kills the compiler #8414

scabug opened this issue Mar 15, 2014 · 2 comments
Milestone

Comments

@scabug
Copy link

scabug commented Mar 15, 2014

object Bug extends App {

  val n = Array.fill(1)(0.0)
  n(0) = ???
  
}

results in

error:
while compiling:
during phase: jvm
library version: version 2.10.3
compiler version: version 2.10.3
reconstructed args:

last tree to typer: This(object iw$Bug)
symbol: object iw$Bug in package $line3 (flags: )
symbol definition: class iw$Bug extends App
tpe: type
symbol owners: object iw$Bug -> package $line3
context owners: object iw -> package $line3

== Enclosing template or block ==

Template( // val <local $iw>: , tree.tpe=type
"java.lang.Object" // parents
ValDef(
private
"_"


)
DefDef( // def (): type

""
[]
List(Nil)
// tree.tpe=type
Block( // tree.tpe=Unit
Apply( // def (): Object in class Object, tree.tpe=Object
$read$super."" // def (): Object in class Object, tree.tpe=()Object
Nil
)
()
)
)
)

== Expanded type of tree ==

TypeRef(TypeSymbol(class iw$Bug extends App))

uncaught exception during compilation: java.lang.NegativeArraySizeException
java.lang.NegativeArraySizeException
at scala.tools.asm.Frame.merge(Frame.java:1326)
at scala.tools.asm.MethodWriter.visitMaxs(MethodWriter.java:1353)
at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1565)
at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1398)
at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1583)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1557)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1553)
at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:428)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:801)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:761)
at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:936)
at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:931)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:603)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:756)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:801)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:774)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:801)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:774)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:801)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:774)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:801)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:774)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:801)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:774)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:801)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:713)
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:577)
at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:584)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:587)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:878)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:833)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:833)
at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:833)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

That entry seems to have slain the compiler. Shall I replay
your session? I can re-run each line except the last one.

@scabug
Copy link
Author

scabug commented Mar 15, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8414?orig=1
Reporter: Scott Morrison (scott)
Affected Versions: 2.10.3, 2.10.4-RC3

@scabug
Copy link
Author

scabug commented May 16, 2014

@adriaanm said:
Fixed in 2.11.

@scabug scabug closed this as completed May 16, 2014
@scabug scabug added this to the 2.11.0 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant