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

lambda + PartialFunction + specialization = "VerifyError: Bad local variable type" #11817

SethTisue opened this issue Dec 2, 2019 · 1 comment


Copy link

@SethTisue SethTisue commented Dec 2, 2019

this came up over at #7288, the original report there got fixed but this version remains broken even in 2.13.1

object SI_7288 {
  type Id[A] = A
  def f[A](pf: PartialFunction[A, Unit]): Unit = ()
  f[Id[Int]] { case _ => }
  def main(args: Array[String]): Unit = ()

Exception in thread "main" java.lang.VerifyError: Bad local variable type
Exception Details:
    Main$$anonfun$1.applyOrElse(ILscala/Function1;)Ljava/lang/Object; @0: aload_1
    Type integer (current frame, locals[1]) is not assignable to reference type

This comment has been minimized.

Copy link

@hrhino hrhino commented Dec 6, 2019

That's because it's actually not the same... This can be minimized to

type Id[A] = A
def fail[A <: Id[Int]](a: A) = a

where the erased type of a is mistakenly computed to be Object, while the erased type of fail is computed to be (I)I.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.