mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Merge ffb5c7504f442f88124f934d36d3f645ddd0c45a into 8e26ca3f5a0768a428871baeb46f8836619cc51a
This commit is contained in:
commit
c93435ccac
@ -708,8 +708,7 @@ fn (mut c Checker) struct_init(mut node ast.StructInit, is_field_zero_struct_ini
|
|||||||
}
|
}
|
||||||
if !field.typ.has_flag(.option) && sym.kind == .interface_
|
if !field.typ.has_flag(.option) && sym.kind == .interface_
|
||||||
&& (!has_noinit && sym.language != .js) && !node.has_update_expr {
|
&& (!has_noinit && sym.language != .js) && !node.has_update_expr {
|
||||||
// TODO: should be an error instead, but first `ui` needs updating.
|
c.error('interface field `${type_sym.name}.${field.name}` must be initialized',
|
||||||
c.note('interface field `${type_sym.name}.${field.name}` must be initialized',
|
|
||||||
node.pos)
|
node.pos)
|
||||||
}
|
}
|
||||||
// Do not allow empty uninitialized sum types
|
// Do not allow empty uninitialized sum types
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
vlib/v/checker/tests/interface_init_err.vv:15:7: notice: interface field `Server.handler` must be initialized
|
vlib/v/checker/tests/interface_init_err.vv:15:7: error: interface field `Server.handler` must be initialized
|
||||||
13 |
|
13 |
|
||||||
14 | fn main() {
|
14 | fn main() {
|
||||||
15 | _ := Server{}
|
15 | _ := Server{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user