#1331 Fix set assignment to work with value types

vkuzkokov Fri 26 Nov 2010

class Storage
  @Operator Int get(Int key) { return 0 }
  @Operator Void set(Int key, Int val) { }
  Void main()

The code above compiles but fails at runtime on attempt to load class with

java.lang.VerifyError: (class: fan/test_0/Storage, method: main signature: ()V)
  Expecting to find long on stack

Because compiler doesn't expect second parameter of set to be primitive. Similar error happens if nullability of key in set and get don't match, because we can't just Dup argument in that case.

brian Fri 26 Nov 2010

Promoted to ticket #1331 and assigned to brian

I will take a look, but no promises I will actually support it (vs just make it a compile time error), that is some of the ugliest code in the compiler.

brian Thu 2 Jun 2011

Renamed from read-write access through overloaded operators to Fix set assignment to work with value types

brian Thu 2 Jun 2011

Ticket resolved in 1.0.59

Fixed the compiler to correctly look at set value parameter to determine if boxing is required.

Login or Signup to reply.