checker.v: suggest []Type{}, not []Type

pull/4720/head
Steve Phillips 2020-05-04 15:20:32 -07:00 committed by GitHub
parent 1c945faa15
commit 081338b8bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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)
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
}
// TODO: seperate errors once bug is fixed with `x := if expr { ... } else { ... }`
// 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
// }
array_info := type_sym.array_info()