1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
Felipe Pena 2023-08-05 20:04:45 +02:00 committed by GitHub
commit c93435ccac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -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_
&& (!has_noinit && sym.language != .js) && !node.has_update_expr {
// TODO: should be an error instead, but first `ui` needs updating.
c.note('interface field `${type_sym.name}.${field.name}` must be initialized',
c.error('interface field `${type_sym.name}.${field.name}` must be initialized',
node.pos)
}
// Do not allow empty uninitialized sum types

View File

@ -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 |
14 | fn main() {
15 | _ := Server{}