mirror of
https://github.com/vlang/v.git
synced 2025-09-09 15:27:05 -04:00
This commit is contained in:
parent
3b8f2fe5f5
commit
00ef1a6c52
@ -2601,6 +2601,9 @@ pub fn (t &Table) dependent_names_in_expr(expr Expr) []string {
|
||||
names << t.dependent_names_in_expr(expr.expr)
|
||||
}
|
||||
StructInit {
|
||||
if expr.has_update_expr {
|
||||
names << t.dependent_names_in_expr(expr.update_expr)
|
||||
}
|
||||
for field in expr.init_fields {
|
||||
names << t.dependent_names_in_expr(field.expr)
|
||||
}
|
||||
|
17
vlib/v/tests/consts/const_depend_update_expr_test.v
Normal file
17
vlib/v/tests/consts/const_depend_update_expr_test.v
Normal file
@ -0,0 +1,17 @@
|
||||
struct Cfg {
|
||||
id string
|
||||
name string
|
||||
}
|
||||
|
||||
pub const cfg1 = Cfg{
|
||||
...cfg0
|
||||
name: 'name1'
|
||||
}
|
||||
pub const cfg0 = Cfg{
|
||||
id: 'cfg0'
|
||||
name: 'name'
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
assert cfg1.id == 'cfg0'
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user