| 1 | struct E { mut: v []int } struct F { e []E } mut f := F{} |
| 2 | f.e << E{} // Error (field e immutable) |
| 3 | f.e[0].v << 1 // Error (field e immutable) |
| 4 | e := E{} |
| 5 | e.v << 1 // Error (e immutable) |
| 6 | ===output=== |
| 7 | cannot modify immutable field `e` (type `F`) |
| 8 | declare the field with `mut:` |
| 9 | struct F { |
| 10 | mut: |
| 11 | e []E |
| 12 | } |
| 13 | cannot modify immutable field `e` (type `F`) |
| 14 | declare the field with `mut:` |
| 15 | struct F { |
| 16 | mut: |
| 17 | e []E |
| 18 | } |
| 19 | `e` is immutable (can't <<) |
| 20 |