compiler: unsigned number properly printed and converted to string

fix: array accessing now works with unsigned numbers
This commit is contained in:
Henrixounez 2019-08-12 01:58:08 +02:00 committed by Alexander Medvednikov
parent 92cb199e8c
commit 872aa536d8
4 changed files with 85 additions and 6 deletions

View file

@ -1962,7 +1962,8 @@ fn (p mut Parser) index_expr(typ_ string, fn_ph int) string {
// expression inside [ ]
if is_arr {
T := p.table.find_type(p.expression())
if T.parent != 'int' {
// Allows only i8-64 and u8-64 to be used when accessing an array
if T.parent != 'int' && T.parent != 'u32' {
p.check_types(T.name, 'int')
}
}