checker.v: suggest []Type{}, not []Type
parent
1c945faa15
commit
081338b8bf
|
@ -1133,12 +1133,12 @@ pub fn (mut c Checker) array_init(array_init mut ast.ArrayInit) table.Type {
|
||||||
}
|
}
|
||||||
type_sym := c.table.get_type_symbol(c.expected_type)
|
type_sym := c.table.get_type_symbol(c.expected_type)
|
||||||
if type_sym.kind != .array {
|
if type_sym.kind != .array {
|
||||||
c.error('array_init: no type specified (maybe: `[]Type` instead of `[]`)', array_init.pos)
|
c.error('array_init: no type specified (maybe: `[]Type{}` instead of `[]`)', array_init.pos)
|
||||||
return table.void_type
|
return table.void_type
|
||||||
}
|
}
|
||||||
// TODO: seperate errors once bug is fixed with `x := if expr { ... } else { ... }`
|
// TODO: seperate errors once bug is fixed with `x := if expr { ... } else { ... }`
|
||||||
// if c.expected_type == table.void_type {
|
// if c.expected_type == table.void_type {
|
||||||
// c.error('array_init: use `[]Type` instead of `[]`', array_init.pos)
|
// c.error('array_init: use `[]Type{}` instead of `[]`', array_init.pos)
|
||||||
// return table.void_type
|
// return table.void_type
|
||||||
// }
|
// }
|
||||||
array_info := type_sym.array_info()
|
array_info := type_sym.array_info()
|
||||||
|
|
Loading…
Reference in New Issue