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
VerifyError when using a matcher in a parent constructor call #8733
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8733?orig=1 |
@som-snytt said: $ scalac -target:jvm-1.7 badchild.scala && scala badchild.Main
version 2.11.1, 1.8.0_05
//import util.Properties._
//Console println s"$versionString, $javaVersion" |
Michael Stringer (stringbean) said:
|
Michael Stringer (stringbean) said: |
@som-snytt said: Welcome to Scala 2.12.0-M3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions for evaluation. Or try :help.
scala> class Parent(val i: Int) { def this(p: Parent) = this(p.i) ; if (i > 40) throw new IllegalArgumentException }
defined class Parent
scala> class Child extends Parent({ val p = try new Parent(42) catch { case _: IllegalArgumentException => throw new RuntimeException }; p})
defined class Child
scala> new Child
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
Child.<init>()V @2: invokespecial
Reason:
Type uninitializedThis (current frame, stack[1]) is not assignable to 'Child'
Current Frame:
bci: @2
flags: { flagThisUninit }
locals: { uninitializedThis }
stack: { uninitializedThis, uninitializedThis }
Bytecode:
0x0000000: 2a2a b700 254c 2bb7 0028 b1
... 28 elided |
|
Progressed in 2.12.0-M5 Test scala/scala#8667 |
The following code causes a
VerifyError
to get thrown as soon as aChild
instance is created:Removing the target JVM results in bytecode that doesn't cause a
VerifyError
.Also running this on Java 1.7.0 update 60 or lower does not cause the error to be thrown.
The text was updated successfully, but these errors were encountered: