checker: make interface init check a warning for now
parent
7d5b6d2b48
commit
ec92964bb0
|
@ -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
|
||||||
|
|
|
@ -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{}
|
||||||
|
|
Loading…
Reference in New Issue