diff --git a/vlib/v/checker/struct.v b/vlib/v/checker/struct.v index 4094b581ab5c49..c977a32d7d13ec 100644 --- a/vlib/v/checker/struct.v +++ b/vlib/v/checker/struct.v @@ -750,8 +750,9 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.', } else { parts.last() } - c.warn('cannot access private field `${field.name}` on `${mod_type}`', - init_field.pos) + c.add_error_detail('this will become an error after 2024-05-31') + c.warn('initalizing private field `${field.name}` of `${mod_type}`', init_field.pos) + // c.error('cannot access private field `${field.name}` on `${mod_type}`', init_field.pos) break } } diff --git a/vlib/v/checker/tests/struct_field_private_err.out b/vlib/v/checker/tests/struct_field_private_err.out index e88fec1d00354f..c9a44768379e74 100644 --- a/vlib/v/checker/tests/struct_field_private_err.out +++ b/vlib/v/checker/tests/struct_field_private_err.out @@ -1,12 +1,14 @@ -vlib/v/checker/tests/struct_field_private_err.vv:8:2: warning: cannot access private field `x` on `amod.Bcg` +vlib/v/checker/tests/struct_field_private_err.vv:8:2: warning: initalizing private field `x` of `amod.Bcg` 6 | 7 | _ := amod.Bcg{ 8 | x: 0 | ~~~~ 9 | } 10 | -vlib/v/checker/tests/struct_field_private_err.vv:11:10: warning: cannot access private field `bar` on `amod.FooParams` +Details: this will become an error after 2024-05-31 +vlib/v/checker/tests/struct_field_private_err.vv:11:10: warning: initalizing private field `bar` of `amod.FooParams` 9 | } 10 | 11 | amod.foo(bar: 'bar') | ~~~~~~~~~~ +Details: this will become an error after 2024-05-31