navid/haze / 94d8e2a026845bd62732f6eb7c222b5a9c18a60511c534c648cee6fd4b471090 / 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)
}