Aladdin - Scala Bugtracking
[#1215] project: compiler priority: high category: bug
submitter assigned to status date submitted
Philipp Burak fixed 2007-07-16 17:16:44.0
subject Backend chokes on unapply
code
package test

class Async {
  def unapply(scrut: Any): Option[Any] = None
}

class Buffer {
  val Put = new Async
  //case class Put(x: int)

  def joinPat(x: Any): Unit =
    x match {
      case Put(y) =>
        println("returning "+y)
    }
}
what happened
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
        at ch.epfl.lamp.fjbg.JExtendedCode.emitT2T(JExtendedCode.java:426)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genPrimitive(GenJVM.scala:1156)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$45.apply(GenJVM.scala:758)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$45.apply(GenJVM.scala:663)
        at scala.Iterator$class.foreach(Iterator.scala:364)
        at scala.runtime.BoxedArray$$anon$0.foreach(BoxedArray.scala:46)
        at scala.Iterable$class.foreach(Iterable.scala:226)
        at scala.runtime.BoxedArray.foreach(BoxedArray.scala:25)
        at scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.traverse(BasicBlocks.scala:102)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlock(GenJVM.scala:663)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlocks(GenJVM.scala:584)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genCode(GenJVM.scala:573)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genMethod(GenJVM.scala:458)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$7.apply(GenJVM.scala:198)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$7.apply(GenJVM.scala:198)
        at scala.List.foreach(List.scala:707)
        at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genClass(GenJVM.scala:198)
        at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$1.apply(GenJVM.scala:47)
        at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$1.apply(GenJVM.scala:47)
        at scala.Iterator$class.foreach(Iterator.scala:364)
        at scala.collection.Map$$anon$5.foreach(Map.scala:123)
        at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase.run(GenJVM.scala:47)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:544)
        at scala.tools.nsc.Global$Run.compile(Global.scala:623)
        at scala.tools.nsc.Main$.process(Main.scala:84)
        at scala.tools.nsc.Main$.main(Main.scala:105)
        at scala.tools.nsc.Main.main(Main.scala)
what expected Successful compilation
[back to overview]
Changes of this bug report
Iulian  edited on  2007-07-16 23:39:46.0
This seems to be very similar to #1213, so I reassign to Burak. The problem in both cases is that the pattern matcher generates some references to a package used as a value. I added an assertion in gen icode so these bugs are cought earlier.
Burak  edited on  2007-08-08 11:25:12.0
it is unrelated to the other bug, but fixed now.