1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: a better [] error message

This commit is contained in:
Alexander Medvednikov 2019-11-19 11:13:19 +03:00
parent fe81ccab20
commit 0cf232d692

View File

@ -2436,7 +2436,7 @@ fn (p mut Parser) array_init() string {
p.tokens[p.token_idx-2].line_nr == p.tokens[p.token_idx-1].line_nr { // TODO
// vals.len == 0 {
if exp_array {
p.error('use `foo = []` instead of `foo = []Type`')
p.error('no need to specify the full array type here, use `[]` instead of `[]${p.expected_type[6..]}`')
}
typ = p.get_type()
} else if exp_array && i == 0 {