v.checker: turn `interface field ... must be initialized` to a notice temporarily
parent
9d4d0a9894
commit
a64a4d932c
|
@ -1175,8 +1175,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_ {
|
||||||
// TODO error
|
// TODO: should be an error instead, but first `ui` needs updating.
|
||||||
c.warn('interface field `${type_sym.name}.$field.name` must be initialized',
|
c.note('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,3 +1,15 @@
|
||||||
|
vlib/v/checker/tests/import_symbol_private_err.vv:11:6: notice: interface field `io.ReaderWriterImpl.r` must be initialized
|
||||||
|
9 | since(now())
|
||||||
|
10 | _ = {'h': 2}.exists('h')
|
||||||
|
11 | _ = ReaderWriterImpl{}
|
||||||
|
| ~~~~~~~~~~~~~~~~~~
|
||||||
|
12 | }
|
||||||
|
vlib/v/checker/tests/import_symbol_private_err.vv:11:6: notice: interface field `io.ReaderWriterImpl.w` must be initialized
|
||||||
|
9 | since(now())
|
||||||
|
10 | _ = {'h': 2}.exists('h')
|
||||||
|
11 | _ = ReaderWriterImpl{}
|
||||||
|
| ~~~~~~~~~~~~~~~~~~
|
||||||
|
12 | }
|
||||||
vlib/v/checker/tests/import_symbol_private_err.vv:3:20: error: module `time` function `since()` is private
|
vlib/v/checker/tests/import_symbol_private_err.vv:3:20: error: module `time` function `since()` is private
|
||||||
1 | import v.scanner
|
1 | import v.scanner
|
||||||
2 | import v.parser
|
2 | import v.parser
|
||||||
|
|
|
@ -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: notice: interface field `Server.handler` must be initialized
|
||||||
13 |
|
13 |
|
||||||
14 | fn main() {
|
14 | fn main() {
|
||||||
15 | _ := Server{}
|
15 | _ := Server{}
|
||||||
|
|
Loading…
Reference in New Issue