mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
@@ -377,6 +377,9 @@ pub fn (mut c Checker) struct_init(mut node ast.StructInit) ast.Type {
|
||||
expected_type = field_info.typ
|
||||
c.expected_type = expected_type
|
||||
expr_type = c.expr(field.expr)
|
||||
if expr_type == ast.void_type {
|
||||
c.error('`$field.expr` (no value) used as value', field.pos)
|
||||
}
|
||||
if !field_info.typ.has_flag(.optional) {
|
||||
expr_type = c.check_expr_opt_call(field.expr, expr_type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user