Aladdin - Scala Bugtracking
[#1009] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Nikolay Iulian fixed 2007-03-16 13:30:04.0
subject [contrib #381] More on VerifyError: Inconsistent stack height 1 != 2
code
object Zdb {
  trait Disposeable {
    def dispose: Unit;
  }
  def using[a <% Disposeable, b](obj: a)(f: a => b) =
    try { f(obj) } finally { obj.dispose }
  class FileTextReader(fname: String)
  extends java.io.BufferedReader(new java.io.FileReader(fname))
  with Disposeable {
    def readLines: Stream[String] = {
      val line = readLine
      if (line == null) Stream.empty
      else Stream.cons(line, readLines)
    }
    def dispose = close
  }
  def getObj(name: String) = { 0 }
  def mk(newNames: String*)(srcNames: String*) = { 0 }
  def main(args: Array[String]): Unit = {
    val r = new FileTextReader("dat/tried-software.txt")
    var obj = -1
    r.readLines foreach { line =>
      obj = try { getObj(line) } catch { case _ => mk(line)("software") }
    }
  }
}
what happened
this repro test case has been greatly reduced from my previous reports (379, 380). i get the following runtime e\
rror (tried-software.txt is an empty file):

$ scala Zdb
java.lang.VerifyError: (class: Zdb$$anonfun$1, method: apply signature: (Ljava/lang/String;)V) Inconsistent stac\
k height 1 != 2
        at Zdb$.main(VerifyErrorBug1.scala:22)
        at Zdb.main(VerifyErrorBug1.scala)
        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.ObjectRunner$.run(ObjectRunner.scala:76)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:106)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
what expected no crash :)
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-03-16 13:30:45.0
contribution #381
Nikolay  edited on  2007-03-16 13:36:40.0
Iuli, also take a look at contribution #382. It might be the same bug so there'd be no need to promote it.
Iulian  edited on  2007-03-16 16:47:49.0
Both contribution were instances of the same bug.