v2 / vlib / v / slow_tests / repl / chained_fields / ef.repl.skip
19 lines · 19 sloc · 433 bytes · 6a32c810703f4ec0c39fe18298ebe6c40acac8f1
Raw
1struct E { mut: v []int } struct F { e []E } mut f := F{}
2f.e << E{} // Error (field e immutable)
3f.e[0].v << 1 // Error (field e immutable)
4e := E{}
5e.v << 1 // Error (e immutable)
6===output===
7cannot modify immutable field `e` (type `F`)
8declare the field with `mut:`
9struct F {
10mut:
11 e []E
12}
13cannot modify immutable field `e` (type `F`)
14declare the field with `mut:`
15struct F {
16mut:
17 e []E
18}
19`e` is immutable (can't <<)
20