checker: make interface init check a warning for now

pull/10999/head
Alexander Medvednikov 2021-07-30 03:31:58 +03:00
parent 7d5b6d2b48
commit ec92964bb0
2 changed files with 4 additions and 3 deletions

View File

@ -1161,7 +1161,8 @@ pub fn (mut c Checker) struct_init(mut node ast.StructInit) ast.Type {
// Do not allow empty uninitialized interfaces // Do not allow empty uninitialized interfaces
sym := c.table.get_type_symbol(field.typ) sym := c.table.get_type_symbol(field.typ)
if sym.kind == .interface_ { if sym.kind == .interface_ {
c.error('interface field `${type_sym.name}.$field.name` must be initialized', // TODO error
c.warn('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

View File

@ -1,4 +1,4 @@
vlib/v/checker/tests/interface_init_err.vv:15:7: error: interface field `Server.handler` must be initialized vlib/v/checker/tests/interface_init_err.vv:15:7: warning: interface field `Server.handler` must be initialized
13 | 13 |
14 | fn main() { 14 | fn main() {
15 | _ := Server{} 15 | _ := Server{}