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

VerifyError with captured object local to super arg #6997

Closed
scabug opened this issue Jan 20, 2013 · 2 comments
Closed

VerifyError with captured object local to super arg #6997

scabug opened this issue Jan 20, 2013 · 2 comments

Comments

@scabug
Copy link

@scabug scabug commented Jan 20, 2013

I created this test case during the investigations for #6666, but I think it's a slightly different issue.

We might end up needing a similar solution (an implementation restriction on what can be captured in this context), but first we should investigate the manner in which this gets to the VerifyError.

First place to look is at the code surrounding the log message "Couldn't determine how to properly construct variable Nested$module".

ticket/6666 ~/code/scala2 cat sandbox/test.scala
class C(a: Any)
object O4 extends C({
  object Nested
  Nested
})
O4
ticket/6666 ~/code/scala2 scala210 -nc -Xprint:lambdalift -Ylog:lambdalift sandbox/test.scala 
[log lambdalift] Renaming object Nested to Nested$1
[log lambdalift] Renaming anonymous class $anon to $anon$1
[log lambdalift] Renaming object Nested to Nested$2
[log lambdalift(->constructors)] Couldn't determine how to properly construct variable Nested$module
[[syntax trees at end of                lambdalift]] // test.scala
package <empty> {
  object Main extends Object {
    def <init>(): Main.type = {
      Main.super.<init>();
      ()
    };
    def main(argv: Array[String]): Unit = {
      val args: Array[String] = argv;
      {
        {
          new anonymous class $anon$1();
          ()
        }
      }
    };
    final class $anon$1 extends Object {
      def <init>(): anonymous class $anon$1 = {
        $anon$1.super.<init>();
        ()
      };
      class C extends Object {
        <paramaccessor> private[this] val a: Object = _;
        def <init>($outer: anonymous class $anon$1, a: Object): this.C = {
          C.super.<init>();
          ()
        };
        <synthetic> <paramaccessor> protected val $outer: anonymous class $anon$1 = _;
        <synthetic> <stable> def Main$$anon$C$$$outer(): anonymous class $anon$1 = C.this.$outer
      };
      object O4 extends C {
        def <init>($outer: anonymous class $anon$1): this.O4.type = {
          O4.super.<init>($outer, {
            @volatile var Nested$module: runtime.VolatileObjectRef = new runtime.VolatileObjectRef(<empty>);
            O4.this.Nested$1(Nested$module, $outer)
          });
          ()
        };
        <synthetic> <stable> def Main$$anon$O4$$$outer(): anonymous class $anon$1 = O4.this.$outer;
        object Nested$2 extends Object {
          def <init>($outer: anonymous class $anon$1): O4.Nested$2.type = {
            Nested$2.super.<init>();
            ()
          };
          <synthetic> <paramaccessor> private[this] val $outer: anonymous class $anon$1 = _;
          <synthetic> <stable> def Main$$anon$O4$Nested$$$outer(): anonymous class $anon$1 = Nested$2.this.$outer
        };
        final <stable> private[this] def Nested$1(Nested$module$1: runtime.VolatileObjectRef, $outer$1: anonymous class $anon$1): O4.Nested$2.type = {
          Nested$module$1.elem = new O4.Nested$2.type($outer$1);
          Nested$module$1.elem.$asInstanceOf[O4.Nested$2.type]()
        }
      };
      @volatile <synthetic> private[this] var O4$module: O4.type = _;
      <stable> private def O4(): O4.type = {
        $anon$1.this.O4$module = new O4.type($anon$1.this);
        $anon$1.this.O4$module
      };
      $anon$1.this.O4()
    }
  }
}

java.lang.VerifyError: (class: Main$$anon$1$O4$, method: <init> signature: (LMain$$anon$1;)V) Expecting to find object/array on stack
	at Main$$anon$1.O4$lzycompute(test.scala:2)
@scabug
Copy link
Author

@scabug scabug commented Jan 20, 2013

Imported From: https://issues.scala-lang.org/browse/SI-6997?orig=1
Reporter: @retronym
Assignee: @JamesIry
Affected Versions: 2.9.2, 2.10.0
See #6666, #6957

Loading

@scabug
Copy link
Author

@scabug scabug commented Jan 23, 2013

@JamesIry said:
Fixing the "Couldn't properly determine" bit in #7011 had no effect on this bug. This one is another form of #6957 / #6666.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant