Lyricdev
GitHub

LYR-PAR0057

an enum's variants not ended by ';' before its members

error · spec 03-types

In an enum body a member — fn, static, an attribute, type Item = — stands where the next variant's name is expected: the ; after the variants is missing.

Explanation

An enum lists its variants, separated by ,, then ;, then its members. A , goes on to the next variant, so a member behind it would be read as one. It is refused once, and the members are read as what they are.

End the variants with ;.

Wrong

enum Level {
    Low, High,
    static let fallback: Level = Level.Low;
}

fn main(): void {
}
enum Level {
    Low, High;
    static let fallback: Level = Level.Low;
}

fn main(): void {
    let _ = Level.fallback;
}