Boo

Invalid IL when a static final 'literal' field is assigned to in static constructor

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.2
  • Fix Version/s: 0.9
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

Testcase:

class Test:
    public static final X = 1

    static def constructor():
        X = 2

print Test.X #prints 1 ... or crash

static final with a literal initializer sets the IL flag 'literal'.
Two solutions:
1) forbidding assignment of static final field, even in static constructor
2) implicitely change IL flag to 'initonly' ... but it can be unwanted behavior

I'd take 1, objections?
edit: changed my mind to 2, it makes thing more consistent with the 'instance final' and non-literal types.

Activity

Hide
Cedric Vivier added a comment -

Fixed in rev. 3151

Show
Cedric Vivier added a comment - Fixed in rev. 3151

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: