Evan Shaw created GROOVY-11751:
----------------------------------

             Summary: VerifyError on indexed for loop
                 Key: GROOVY-11751
                 URL: https://issues.apache.org/jira/browse/GROOVY-11751
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 5.0.0
            Reporter: Evan Shaw


 

When the index of a for loop is captured by a closure, it causes a VerifyError.

Example code:

 

 
{code:java}
for(i, v in []){println i}(){code}
 

Error contents:

 
{code:java}
Caught: java.lang.VerifyError: Bad local variable type
Exception Details:
  Location:
    test.run()Ljava/lang/Object; @53: iinc
  Reason:
    Type top (current frame, locals[1]) is not assignable to integer
  Current Frame:
    bci: @53
    flags: { }
    locals: { 'test', top, 'java/lang/Object', 'java/util/Iterator' }
    stack: { }
  Bytecode:
    0000000: 03bd 002d b800 33ba 0038 0000 ba00 3e00
    0000010: 0002 b800 44bb 0046 5a5f b700 494c 014d
    0000020: 4e2d c600 292d b900 4f01 0099 0020 2db9
    0000030: 0052 0100 4d84 0101 bb00 5459 2a2a 2bb7
    0000040: 0057 ba00 5c00 0057 a7ff dd01 b0
  Stackmap Table:
    append_frame(@37,Top,Object[#45],Object[#75])
    same_frame(@75) {code}
 

 



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

Reply via email to