1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: remove check for option being initialized (#18280)

This commit is contained in:
Felipe Pena 2023-05-27 15:43:54 -03:00 committed by GitHub
parent 16ef1d95fb
commit 5812579d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -645,7 +645,8 @@ fn (mut c Checker) struct_init(mut node ast.StructInit, is_field_zero_struct_ini
break
}
}
if sym.kind == .interface_ && (!has_noinit && sym.language != .js) {
if !field.typ.has_flag(.option) && sym.kind == .interface_
&& (!has_noinit && sym.language != .js) {
// TODO: should be an error instead, but first `ui` needs updating.
c.note('interface field `${type_sym.name}.${field.name}` must be initialized',
node.pos)