v2 / vlib / v / checker / tests / closure_immutable.out
21 lines · 21 sloc · 800 bytes · a9a94cfd51e01c6e0985c60049f1e82dbb7da1e2
Raw
1vlib/v/checker/tests/closure_immutable.vv:4:3: error: the closure copy of `a` is immutable, declare it with `mut` to make it mutable
2 2 | a := 1
3 3 | f1 := fn [a] () {
4 4 | a++
5 | ^
6 5 | println(a)
7 6 | }
8vlib/v/checker/tests/closure_immutable.vv:7:16: error: original `a` is immutable, declare it with `mut` to make it mutable
9 5 | println(a)
10 6 | }
11 7 | f2 := fn [mut a] () {
12 | ^
13 8 | a++
14 9 | println(a)
15vlib/v/checker/tests/closure_immutable.vv:13:3: error: the closure copy of `b` is immutable, declare it with `mut` to make it mutable
16 11 | mut b := 2
17 12 | f3 := fn [b] () {
18 13 | b++
19 | ^
20 14 | println(b)
21 15 | }
22