checker: remove duplicated unsafe tests (#7216)
parent
22d6504ff9
commit
92a8db5b2b
|
@ -26,9 +26,3 @@ vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:12:9: error:
|
||||||
| ^
|
| ^
|
||||||
13 | _ := q
|
13 | _ := q
|
||||||
14 | _ := v
|
14 | _ := v
|
||||||
vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:24:7: error: method `S1.f` must be called from an `unsafe` block
|
|
||||||
22 | fn test_funcs() {
|
|
||||||
23 | s := S1{}
|
|
||||||
24 | s.f()
|
|
||||||
| ~~~
|
|
||||||
25 | }
|
|
||||||
|
|
|
@ -13,13 +13,3 @@ fn test_ptr_infix() {
|
||||||
_ := q
|
_ := q
|
||||||
_ := v
|
_ := v
|
||||||
}
|
}
|
||||||
|
|
||||||
struct S1 {}
|
|
||||||
|
|
||||||
[unsafe]
|
|
||||||
fn (s S1) f(){}
|
|
||||||
|
|
||||||
fn test_funcs() {
|
|
||||||
s := S1{}
|
|
||||||
s.f()
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,48 +1,20 @@
|
||||||
vlib/v/checker/tests/unsafe_required.vv:4:3: error: pointer arithmetic is only allowed in `unsafe` blocks
|
vlib/v/checker/tests/unsafe_required.vv:8:7: error: method `S1.f` must be called from an `unsafe` block
|
||||||
2 | mut v := 5
|
6 | fn test_funcs() {
|
||||||
3 | mut p := &v
|
7 | s := S1{}
|
||||||
4 | p++
|
8 | s.f()
|
||||||
| ~~
|
|
||||||
5 | p += 2
|
|
||||||
6 | _ := v
|
|
||||||
vlib/v/checker/tests/unsafe_required.vv:5:4: error: pointer arithmetic is only allowed in `unsafe` blocks
|
|
||||||
3 | mut p := &v
|
|
||||||
4 | p++
|
|
||||||
5 | p += 2
|
|
||||||
| ~~
|
|
||||||
6 | _ := v
|
|
||||||
7 | }
|
|
||||||
vlib/v/checker/tests/unsafe_required.vv:11:14: error: pointer arithmetic is only allowed in `unsafe` blocks
|
|
||||||
9 | fn test_ptr_infix() {
|
|
||||||
10 | v := 4
|
|
||||||
11 | mut q := &v - 1
|
|
||||||
| ^
|
|
||||||
12 | q = q + 3
|
|
||||||
13 | _ := q
|
|
||||||
vlib/v/checker/tests/unsafe_required.vv:12:9: error: pointer arithmetic is only allowed in `unsafe` blocks
|
|
||||||
10 | v := 4
|
|
||||||
11 | mut q := &v - 1
|
|
||||||
12 | q = q + 3
|
|
||||||
| ^
|
|
||||||
13 | _ := q
|
|
||||||
14 | _ := v
|
|
||||||
vlib/v/checker/tests/unsafe_required.vv:24:7: error: method `S1.f` must be called from an `unsafe` block
|
|
||||||
22 | fn test_funcs() {
|
|
||||||
23 | s := S1{}
|
|
||||||
24 | s.f()
|
|
||||||
| ~~~
|
| ~~~
|
||||||
25 | }
|
9 | }
|
||||||
26 |
|
10 |
|
||||||
vlib/v/checker/tests/unsafe_required.vv:32:7: error: pointer indexing is only allowed in `unsafe` blocks
|
vlib/v/checker/tests/unsafe_required.vv:16:7: error: pointer indexing is only allowed in `unsafe` blocks
|
||||||
30 | _ = b[0]
|
14 | _ = b[0] // OK
|
||||||
31 | c := &b
|
15 | c := &b
|
||||||
32 | _ = c[0]
|
16 | _ = c[0]
|
||||||
| ~~~
|
| ~~~
|
||||||
33 |
|
17 |
|
||||||
34 | v := 4
|
18 | v := 4
|
||||||
vlib/v/checker/tests/unsafe_required.vv:36:10: error: pointer indexing is only allowed in `unsafe` blocks
|
vlib/v/checker/tests/unsafe_required.vv:20:10: error: pointer indexing is only allowed in `unsafe` blocks
|
||||||
34 | v := 4
|
18 | v := 4
|
||||||
35 | p := &v
|
19 | p := &v
|
||||||
36 | _ = p[0]
|
20 | _ = p[0]
|
||||||
| ~~~
|
| ~~~
|
||||||
37 | }
|
21 | }
|
||||||
|
|
|
@ -1,19 +1,3 @@
|
||||||
fn test_ptr_assign() {
|
|
||||||
mut v := 5
|
|
||||||
mut p := &v
|
|
||||||
p++
|
|
||||||
p += 2
|
|
||||||
_ := v
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test_ptr_infix() {
|
|
||||||
v := 4
|
|
||||||
mut q := &v - 1
|
|
||||||
q = q + 3
|
|
||||||
_ := q
|
|
||||||
_ := v
|
|
||||||
}
|
|
||||||
|
|
||||||
struct S1 {}
|
struct S1 {}
|
||||||
|
|
||||||
[unsafe]
|
[unsafe]
|
||||||
|
@ -25,9 +9,9 @@ fn test_funcs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_ptr_index(mut a []string) {
|
fn test_ptr_index(mut a []string) {
|
||||||
_ = a[0]
|
_ = a[0] // OK
|
||||||
b := ['jo']
|
b := ['jo']
|
||||||
_ = b[0]
|
_ = b[0] // OK
|
||||||
c := &b
|
c := &b
|
||||||
_ = c[0]
|
_ = c[0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue