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

checker: check struct field with default expression (#15151)

This commit is contained in:
yuyi
2022-07-21 15:33:34 +08:00
committed by GitHub
parent 49228e1acd
commit 7029e39088
3 changed files with 12 additions and 1 deletions

View File

@@ -320,7 +320,7 @@ pub fn (mut c Checker) struct_init(mut node ast.StructInit) ast.Type {
}
if type_sym.name.len == 1 && !isnil(c.table.cur_fn) && c.table.cur_fn.generic_names.len == 0 {
c.error('unknown struct `$type_sym.name`', node.pos)
return 0
return ast.void_type
}
match type_sym.kind {
.placeholder {