Lyricdev
GitHub

LYR-PAR0029

fields of a struct or class without ',' between them

error ยท spec 03-types

In the body of a struct or class, a field is followed by another member without a , between them.

Explanation

The members of a struct or class are separated by , after each field; a method with a block body, a static let and an associated type end themselves and need none. Without the rule x: int y: int would read as one line.

Write , after the field.

Wrong

struct Point {
    x: int
    y: int
}

fn main(): void {
}
struct Point {
    x: int,
    y: int,
}

fn main(): void {
    let p = Point { x = 1, y = 2 };
    let _ = p.x + p.y;
}