Skip to content

Commit

Permalink
checker: remove unnecessary struct ref field initialization checks an…
Browse files Browse the repository at this point in the history
…d notifications at map initializing(fix #20245) (#20251)
  • Loading branch information
shove70 committed Dec 22, 2023
1 parent cedf631 commit dda2b56
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
1 change: 0 additions & 1 deletion vlib/v/checker/containers.v
Expand Up @@ -405,7 +405,6 @@ fn (mut c Checker) map_init(mut node ast.MapInit) ast.Type {
c.ensure_type_exists(info.value_type, node.pos)
node.key_type = info.key_type
node.value_type = info.value_type
c.check_elements_ref_fields_initialized(node.typ, node.pos)
return node.typ
}

Expand Down
@@ -1,5 +1,5 @@
vlib/v/checker/tests/array_map_elements_ref_fields_uninitialized_err.vv:8:6: notice: reference field `Foo.n` must be initialized (part of struct `Foo`)
6 |
6 |
7 | fn main() {
8 | _ = []Foo{len: 1}
| ~~~~~~
Expand All @@ -12,20 +12,6 @@ vlib/v/checker/tests/array_map_elements_ref_fields_uninitialized_err.vv:9:6: not
| ~~~~~~~~
10 | _ = map[string]Foo{}
11 | _ = map[string][]Foo{}
vlib/v/checker/tests/array_map_elements_ref_fields_uninitialized_err.vv:10:6: notice: reference field `Foo.n` must be initialized (part of struct `Foo`)
8 | _ = []Foo{len: 1}
9 | _ = [1]Foo{}
10 | _ = map[string]Foo{}
| ~~~~~~~~~~~~~~~~
11 | _ = map[string][]Foo{}
12 | _ = []AliasFoo{len: 1}
vlib/v/checker/tests/array_map_elements_ref_fields_uninitialized_err.vv:11:6: notice: reference field `Foo.n` must be initialized (part of struct `Foo`)
9 | _ = [1]Foo{}
10 | _ = map[string]Foo{}
11 | _ = map[string][]Foo{}
| ~~~~~~~~~~~~~~~~~~
12 | _ = []AliasFoo{len: 1}
13 | }
vlib/v/checker/tests/array_map_elements_ref_fields_uninitialized_err.vv:12:6: notice: reference field `Foo.n` must be initialized (part of struct `Foo`)
10 | _ = map[string]Foo{}
11 | _ = map[string][]Foo{}
Expand Down

0 comments on commit dda2b56

Please sign in to comment.