简体   繁体   中英

Scala 2.10 - compiler bug?

Is this a compiler bug?

class A(val pf: PartialFunction[Int, Int])
class B extends A({
  case 5 => 3
  case _ => 2
})

println(new B)

java.lang.VerifyError: (class: Main$$anon$1$B, method: <init> signature: (LMain$$anon$1;)V) Expecting to find object/array on stack

I'm using Scala 2.10 RC3 and Java 7u9

edit: forgot the "new B" at the end of my code. Without that the error doesn't occur

Here's an issue which looks rather similar, including As and Bs. I usually save As for type params, which is how I know I'm not coding in Java.

Upgrade to Scala-2.10-RC3 - it works here!

class B extends A (new PartialFunction[Int, Int]{
  def apply(v: Int) = v match {
    case 3 => 4
    case _ => 0
  }
  def isDefinedAt(v: Int) = true 
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM