mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: make the "reference field must be initialised" warning more informative, fix clipboard
(used by ui
)
This commit is contained in:
parent
b158da398b
commit
b83d0281e4
@ -140,12 +140,12 @@ enum AtomType {
|
||||
|
||||
[heap]
|
||||
pub struct Clipboard {
|
||||
display &C.Display
|
||||
display &C.Display = unsafe { nil }
|
||||
mut:
|
||||
selection Atom // the selection atom
|
||||
window Window
|
||||
atoms []Atom
|
||||
mutex &sync.Mutex
|
||||
mutex &sync.Mutex = unsafe { nil }
|
||||
text string // text data sent or received
|
||||
got_text bool // used to confirm that we have got the text
|
||||
is_owner bool // to save selection owner state
|
||||
|
@ -608,7 +608,7 @@ fn (mut c Checker) check_ref_fields_initialized(struct_sym &ast.TypeSymbol, mut
|
||||
continue
|
||||
}
|
||||
if field.typ.is_ptr() && !field.typ.has_flag(.shared_f) && !field.has_default_expr {
|
||||
c.warn('reference field `${linked_name}.$field.name` must be initialized',
|
||||
c.warn('reference field `${linked_name}.$field.name` must be initialized (part of struct `$struct_sym.name`)',
|
||||
node.pos)
|
||||
continue
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/struct_field_reference_type_err.vv:12:16: warning: reference field `Animal.duck.age` must be initialized
|
||||
vlib/v/checker/tests/struct_field_reference_type_err.vv:12:16: warning: reference field `Animal.duck.age` must be initialized (part of struct `Duck`)
|
||||
10 |
|
||||
11 | fn main() {
|
||||
12 | mut animal := Animal{
|
||||
|
@ -1,11 +1,11 @@
|
||||
vlib/v/checker/tests/struct_ref_fields_uninitialized_err.vv:25:7: warning: reference field `Outer.c1.b` must be initialized
|
||||
vlib/v/checker/tests/struct_ref_fields_uninitialized_err.vv:25:7: warning: reference field `Outer.c1.b` must be initialized (part of struct `ContainsRef`)
|
||||
23 |
|
||||
24 | fn main() {
|
||||
25 | _ := Outer{}
|
||||
| ~~~~~~~
|
||||
26 | _ := Struct{}
|
||||
27 | }
|
||||
vlib/v/checker/tests/struct_ref_fields_uninitialized_err.vv:25:7: warning: reference field `Outer.c2.b` must be initialized
|
||||
vlib/v/checker/tests/struct_ref_fields_uninitialized_err.vv:25:7: warning: reference field `Outer.c2.b` must be initialized (part of struct `ContainsRef`)
|
||||
23 |
|
||||
24 | fn main() {
|
||||
25 | _ := Outer{}
|
||||
|
Loading…
Reference in New Issue
Block a user