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