| 1 | // error in non-mut as receover |
| 2 | struct Box { |
| 3 | mut: |
| 4 | value int |
| 5 | } |
| 6 | |
| 7 | fn (mut box Box) set(value int) { |
| 8 | box.value = value |
| 9 | } |
| 10 | |
| 11 | fn non_mut_receiver() { |
| 12 | Box{}.set(0) |
| 13 | } |
| 14 | |
| 15 | // error in array chained method calls |
| 16 | fn array_chained_method_calls() { |
| 17 | path := 'hello/file.txt' |
| 18 | _ = path.split('.').pop() |
| 19 | } |
| 20 | |
| 21 | // error in map chained method calls |
| 22 | fn map_chained_method_calls() { |
| 23 | mut m := map[int]int{} |
| 24 | m.clone().delete(0) |
| 25 | } |
| 26 |