navid/haze / 90400c3cb2eb4f37a299a5eb96dbf6c3ad2fda3fc79b7a824ce800f18386f55d / samples/baseline_2.7/const_field_assign_error.hz

const_field_assign_error.hz

← samples/baseline_2.7 · 178 bytes · raw · download

// Fields cannot be assigned through a const value.

type Point {
    x i32
    y i32
}

fn main() {
    const point = Point{ x = 1, y = 2 }
    point.x = 5
    print(point.x)
}