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

update []

This commit is contained in:
Alexander Medvednikov
2019-11-14 09:53:05 +03:00
parent 4a833d8151
commit 96b530cf85
7 changed files with 41 additions and 40 deletions

View File

@ -2428,13 +2428,14 @@ fn (p mut Parser) array_init() string {
if p.tok != .name && i == 0 && !exp_array {
p.error('specify array type: `[]typ` instead of `[]`')
}
if p.tok == .name && i == 0 {
if p.tok == .name && i == 0 &&
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`')
}
typ = p.get_type()
} else if exp_array {
} else if exp_array && i == 0 {
// allow `known_array = []`
typ = p.expected_type[6..]
}