Allow `static` stored properties in enums

IDE: Visual Studio X/Fire
Version: 10.0.0.2405 (develop)
Target (If relevant): OSX
Description:
Although enums cannot have instance stored properties, they should be able to have static (type) stored properties.

Expected Behavior:
Compiles
Actual Behavior:
“E: One of “case”, “func”, “subscript”, “var”, “typealias”, “init” expected, got assign [<file> (<line>)]”
Steps:

enum F {
    static var x: Int = 5 // Error Here
}

Thanks, logged as bugs://82655

bugs://82655 got closed with status fixed.

Dante,

FWIW< while some of the stuff you’ve bene reporting is in “crazy, who designed this language, I need to go bang my head against the wall” territory, it’s much appreciated getting these reports, because after all Swift is what it is, and many of these odd corner cases can be hard to find.

So thank you for bringing these to our attention!

—marc

2 Likes

Adding to report in Version: 10.0.0.2407 (develop):

It could also be immutable and declared with let

enum F {
    static let x: Int = 5 // Error
}

bugs://82655 got reopened.

bugs://82655 got closed with status fixed.