We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b8f2fe commit 00ef1a6Copy full SHA for 00ef1a6
vlib/v/ast/table.v
@@ -2601,6 +2601,9 @@ pub fn (t &Table) dependent_names_in_expr(expr Expr) []string {
2601
names << t.dependent_names_in_expr(expr.expr)
2602
}
2603
StructInit {
2604
+ if expr.has_update_expr {
2605
+ names << t.dependent_names_in_expr(expr.update_expr)
2606
+ }
2607
for field in expr.init_fields {
2608
names << t.dependent_names_in_expr(field.expr)
2609
vlib/v/tests/consts/const_depend_update_expr_test.v
@@ -0,0 +1,17 @@
1
+struct Cfg {
2
+ id string
3
+ name string
4
+}
5
+
6
+pub const cfg1 = Cfg{
7
+ ...cfg0
8
+ name: 'name1'
9
10
+pub const cfg0 = Cfg{
11
+ id: 'cfg0'
12
+ name: 'name'
13
14
15
+fn test_main() {
16
+ assert cfg1.id == 'cfg0'
17
0 commit comments