Skip to content

VerifyError when extending class has var parameter #14422

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

Closed
TjarkoG opened this issue Feb 7, 2022 · 3 comments
Closed

VerifyError when extending class has var parameter #14422

TjarkoG opened this issue Feb 7, 2022 · 3 comments
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label

Comments

@TjarkoG
Copy link

TjarkoG commented Feb 7, 2022

Possibly a dupplicat of #14265 or caused by the same Bug

Compiler version

Compiler Version: scala 3.1.0 with oracle java 17.0.2 2022-01-18 LTS

Minimized code

class A {
  class B(z: Any) {}
  class C(var y: Any) extends B(y) {}
  val c = new C("bar")
}

@main def test() =
  new A

Output

Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    A$C.<init>(LA;Ljava/lang/Object;)V @25: invokevirtual
  Reason:
    Type uninitializedThis (current frame, stack[2]) is not assignable to 'A$C'
  Current Frame:
    bci: @25
    flags: { flagThisUninit }
    locals: { uninitializedThis, 'A', 'java/lang/Object' }
    stack: { uninitializedThis, 'A', uninitializedThis }
  Bytecode:
    0000000: 2a2c b500 112b c700 0bbb 0013 59b7 0016
    0000010: bf2a 2bb5 0018 2a2b 2ab6 001b b700 1db1
    0000020:                                        
  Stackmap Table:
    same_frame(@17)

	at A.<init>(Main.scala:4)
	at Main$package$.test(Main.scala:8)
	at test.main(Main.scala:7)

Expectation

I would expect this to run like in scala 2.13

@TjarkoG TjarkoG added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 7, 2022
@smarter
Copy link
Member

smarter commented Feb 7, 2022

Yes that looks like a duplicate but it's good to know it happens with non-enums too.

@smarter
Copy link
Member

smarter commented Feb 7, 2022

actually this is already fixed in 3.1.1.

@som-snytt
Copy link
Contributor

#13630

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

No branches or pull requests

3 participants