Eric Milles created GROOVY-11122:
------------------------------------

             Summary: SC: non-static inner class named-argument constructor 
within closure
                 Key: GROOVY-11122
                 URL: https://issues.apache.org/jira/browse/GROOVY-11122
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
class Foo {
  class Bar {
    def baz
  }

  void test() {
    { ->
      new Bar(baz: null)
    }.call()
  }
}

new Foo().test()
{code}

The constructor call "new Bar(...)" produces an error at runtime:
{code}
VerifyError: Bad type on operand stack
Exception Details:
  Location:
    Foo$_test_closure1.doCall()LFoo$Bar; @5: invokespecial
  Reason:
    Type 'Foo$_test_closure1' (current frame, stack[2]) is not assignable to 
'Foo'
  Current Frame:
    bci: @5
    flags: { }
    locals: { 'Foo$_test_closure1' }
    stack: { uninitialized 0, uninitialized 0, 'Foo$_test_closure1' }
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to