Skip to content

Commit

Permalink
update warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 9, 2024
1 parent 021e9e9 commit 246cc89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions vlib/v/checker/struct.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
6 changes: 4 additions & 2 deletions vlib/v/checker/tests/struct_field_private_err.out
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 246cc89

Please sign in to comment.