Simn / genjvm

13 stars 1 forks source link

Something is wrong with closures #28

Closed Simn closed 5 years ago

Simn commented 5 years ago

The unit tests throw this at me:

Error: Expr function(c2:Int) {
        return a26 + b17 + c2;
}
Stack error
        ops      :
                 121 ldc_w 329 [(Lunit/TestArrowFunctions$2;I)I]
                 121   new 318 [, (Lunit/TestArrowFunctions$2;I)I]
                 121       dup [, , (Lunit/TestArrowFunctions$2;I)I]
                 121   aload_0 [Ljava/lang/Integer;, , , (Lunit/TestArrowFunctions$2;I)I]
                 121   iload_1 [I, Ljava/lang/Integer;, , , (Lunit/TestArrowFunctions$2;I)I]
             line: 121
        operation: invokespecial unit/TestArrowFunctions$2.<init>:(II)V
        expected : [I, I, Lunit/TestArrowFunctions$2;]
        actual   : [I, Ljava/lang/Integer;, , , (Lunit/TestArrowFunctions$2;I)I]
Method unit.TestArrowFunctions.testSyntax

This probably means that there's some disconnect between types somewhere. Relying on v_type is bad because the run-time type could be something else if captured.