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