Skip to content

VerifyError with weird circular reference in class defΒ #9270

Open
@som-snytt

Description

@som-snytt

Minimized code

class C:
  object Foo extends Foo.Bar.Base:
    object Bar:
      class Base

@main def test() =
  val c = new C
  val x = new c.Foo.Bar.Base

Output

$ dotc -d /tmp nested.scala && dotr -classpath /tmp test
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    C$Foo$.<init>(LC;)V @19: invokevirtual
  Reason:
    Type uninitializedThis (current frame, stack[1]) is not assignable to 'C$Foo$'
  Current Frame:
    bci: @19
    flags: { flagThisUninit }
    locals: { uninitializedThis, 'C' }
    stack: { uninitializedThis, uninitializedThis }
  Bytecode:
    0000000: 2bc7 000b bb00 1959 b700 1cbf 2a2b b500
    0000010: 1e2a 2ab6 0022 b700 25b1
  Stackmap Table:
    same_frame(@12)

        at C.Foo(nested.scala:2)
        at nested$package$.test(nested.scala:8)
        at test.main(nested.scala:6)

Expectation

Anything besides a VerifyError.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions