vxx2 / vlib / v / checker / tests / fn_var.out
44 lines · 44 sloc · 1.45 KB · 07c796b670d9e498ccb25605af189617f61ec295
Raw
1vlib/v/checker/tests/fn_var.vv:1:10: error: missing return at the end of an anonymous function
2 1 | mut f := fn (i int) u8 {}
3 | ~~~~~~~~~~~~~~~~
4 2 | f = 4
5 3 | mut p := &f
6vlib/v/checker/tests/fn_var.vv:2:5: error: cannot assign to `f`: expected `fn (int) u8`, not `int literal`
7 1 | mut f := fn (i int) u8 {}
8 2 | f = 4
9 | ^
10 3 | mut p := &f
11 4 | p = &[f]
12vlib/v/checker/tests/fn_var.vv:4:5: error: cannot assign to `p`: expected `&fn (int) u8`, not `&[]fn (int) u8`
13 2 | f = 4
14 3 | mut p := &f
15 4 | p = &[f]
16 | ^
17 5 | _ = p
18 6 | i := 0
19vlib/v/checker/tests/fn_var.vv:9:10: error: `i` must be explicitly listed as inherited variable to be used inside a closure
20 7 | println(i)
21 8 | f = fn (mut a []int) {
22 9 | println(i)
23 | ^
24 10 | }
25Details: use `fn [i] () {` instead of `fn () {`
26vlib/v/checker/tests/fn_var.vv:9:2: error: `println` can not print void expressions
27 7 | println(i)
28 8 | f = fn (mut a []int) {
29 9 | println(i)
30 | ~~~~~~~~~~
31 10 | }
32vlib/v/checker/tests/fn_var.vv:9:10: error: undefined ident: `i`
33 7 | println(i)
34 8 | f = fn (mut a []int) {
35 9 | println(i)
36 | ^
37 10 | }
38vlib/v/checker/tests/fn_var.vv:8:5: error: cannot assign to `f`: expected `fn (int) u8`, not `fn (mut []int)`
39 6 | i := 0
40 7 | println(i)
41 8 | f = fn (mut a []int) {
42 | ~~~~~~~~~~~~~~~~~~
43 9 | println(i)
44 10 | }
45