parser: do not allow [x]byte{}

Alexander Medvednikov 2022-04-15 20:40:23 +03:00 committed by Jef Roosens
parent 4da9c52b91
commit 0c2984ff93
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 3 additions and 0 deletions

View File

@ -68,6 +68,9 @@ fn (mut p Parser) array_init() ast.ArrayInit {
if exprs.len == 1 && p.tok.kind in [.name, .amp, .lsbr] && p.tok.line_nr == line_nr {
// [100]u8
elem_type = p.parse_type()
if p.table.sym(elem_type).name == 'byte' {
p.error('`byte` has been deprecated in favor of `u8`: use `[10]u8` instead of `[10]byte`')
}
last_pos = p.tok.pos()
is_fixed = true
if p.tok.kind == .lcbr {