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

Open
SethTisue opened this issue Dec 2, 2019 · 1 comment
Assignees
Milestone

Comments

@SethTisue
Copy link
Member

@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:
  Location:
    Main$$anonfun$1.applyOrElse(ILscala/Function1;)Ljava/lang/Object; @0: aload_1
  Reason:
    Type integer (current frame, locals[1]) is not assignable to reference type
@hrhino

This comment has been minimized.

Copy link
Member

@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
Projects
None yet
2 participants
You can’t perform that action at this time.