v2 / vlib / v / checker / tests / module_with_deprecated_structs / module.v
37 lines · 31 sloc · 870 bytes · 3ffc951cf555dc4818309a507ccb9d0da4de748f
Raw
1module module_with_deprecated_structs
2
3pub struct Xyz {
4pub mut:
5 a int
6 b int @[deprecated]
7 c int @[deprecated: 'c use Xyz.a instead'; deprecated_after: '2021-03-01']
8 d int @[deprecated: 'd use Xyz.a instead'; deprecated_after: '2999-03-01']
9}
10
11@[deprecated: 'use New instead']
12@[deprecated_after: '2021-03-01']
13pub struct Old {}
14
15@[deprecated: 'use Future instead']
16@[deprecated_after: '2999-03-01']
17pub struct Present {}
18
19fn some_internal_function() {
20 mut x := Xyz{} // initialisation; no error
21 mut o := Old{}
22 mut p := Present{}
23
24 // reads:
25 dump(x.a) // no error
26 dump(x.b) // no error internally
27 dump(x.c) // no error internally
28 dump(x.d) // no error internally
29 dump(o) // no error internally
30 dump(p) // no error internally
31
32 // writes:
33 x.a = 1 // no error
34 x.b = 1 // no error internally
35 x.c = 1 // no error internally
36 x.d = 1 // no error internally
37}
38