parser: do not allow [x]byte{}

master
Alexander Medvednikov 2022-04-15 20:40:23 +03:00
parent 6f5a513d8b
commit c03fe020bf
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 {