blob: 47cdde5695537a93e3e16947929800455b6a4c60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
struct Aaa { mut: v int } struct Bbb { a Aaa } struct Ccc { mut: b Bbb } struct Ddd { mut: c Ccc }
mut c := Ccc{} c.b = Bbb{}
c.b.a = Aaa{} // Error (field a immutable)
c.b.a.v = 1 // Error (field a immutable)
===output===
cannot modify immutable field `a` (type `Bbb`)
declare the field with `mut:`
struct Bbb {
mut:
a Aaa
}
cannot modify immutable field `a` (type `Bbb`)
declare the field with `mut:`
struct Bbb {
mut:
a Aaa
}
|