diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index 1a167e3bfc..06e898bb50 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -223,7 +223,7 @@ pub: pub mut: exprs []Expr expr_types []Type - fmts []byte + fmts []u8 need_fmts []bool // an explicit non-default fmt required, e.g. `x` } @@ -689,7 +689,7 @@ pub: pub mut: // these are set by gen_embed_file_init in v/gen/c/embed is_compressed bool - bytes []byte + bytes []u8 len int } diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index 53a489ab4b..818840703c 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -2111,7 +2111,6 @@ pub fn (t &Table) is_comptime_type(x Type, y ComptimeType) bool { .i16, .int, .i64, - .byte, .u8, .u16, .u32, diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index 40546c79f9..8a65fb5444 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -556,7 +556,6 @@ pub enum Kind { int i64 isize - byte u8 u16 u32 @@ -745,7 +744,7 @@ pub fn (mut t Table) register_builtin_type_symbols() { t.register_sym(kind: .int, name: 'int', cname: 'int', mod: 'builtin') t.register_sym(kind: .i64, name: 'i64', cname: 'i64', mod: 'builtin') t.register_sym(kind: .isize, name: 'isize', cname: 'isize', mod: 'builtin') - t.register_sym(kind: .byte, name: 'u8', cname: 'u8', mod: 'builtin') + t.register_sym(kind: .u8, name: 'u8', cname: 'u8', mod: 'builtin') t.register_sym(kind: .u16, name: 'u16', cname: 'u16', mod: 'builtin') t.register_sym(kind: .u32, name: 'u32', cname: 'u32', mod: 'builtin') t.register_sym(kind: .u64, name: 'u64', cname: 'u64', mod: 'builtin') @@ -793,7 +792,7 @@ pub fn (t &TypeSymbol) is_pointer() bool { [inline] pub fn (t &TypeSymbol) is_int() bool { - res := t.kind in [.i8, .i16, .int, .i64, .isize, .byte, .u16, .u32, .u64, .usize, .int_literal, + res := t.kind in [.i8, .i16, .int, .i64, .isize, .u8, .u16, .u32, .u64, .usize, .int_literal, .rune] if !res && t.kind == .alias { return (t.info as Alias).parent_type.is_number() @@ -840,7 +839,6 @@ pub fn (k Kind) str() string { .i16 { 'i16' } .i64 { 'i64' } .isize { 'isize' } - .byte { 'byte' } .u8 { 'u8' } .u16 { 'u16' } .u32 { 'u32' } @@ -1021,8 +1019,8 @@ pub fn (t &Table) type_to_str_using_aliases(typ Type, import_aliases map[string] // explicitly. match sym.kind { .int_literal, .float_literal {} - .i8, .i16, .int, .i64, .isize, .byte, .u8, .u16, .u32, .u64, .usize, .f32, .f64, .char, - .rune, .string, .bool, .none_, .voidptr, .byteptr, .charptr { + .i8, .i16, .int, .i64, .isize, .u8, .u16, .u32, .u64, .usize, .f32, .f64, .char, .rune, + .string, .bool, .none_, .voidptr, .byteptr, .charptr { // primitive types res = sym.kind.str() } diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 419ed5a038..4dbecd620f 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -2830,7 +2830,7 @@ pub fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type { if to_sym.language != .c { c.ensure_type_exists(to_type, node.pos) or {} } - if from_sym.kind == .byte && from_type.is_ptr() && to_sym.kind == .string && !to_type.is_ptr() { + if from_sym.kind == .u8 && from_type.is_ptr() && to_sym.kind == .string && !to_type.is_ptr() { c.error('to convert a C string buffer pointer to a V string, use x.vstring() instead of string(x)', node.pos) } @@ -2898,7 +2898,7 @@ pub fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type { type_name := c.table.type_to_str(to_type) c.error('cannot cast struct `$from_type_name` to `$type_name`', node.pos) } - } else if to_sym.kind == .byte && !final_from_sym.is_number() && !final_from_sym.is_pointer() + } else if to_sym.kind == .u8 && !final_from_sym.is_number() && !final_from_sym.is_pointer() && !from_type.is_ptr() && final_from_sym.kind !in [.char, .enum_, .bool] { ft := c.table.type_to_str(from_type) tt := c.table.type_to_str(to_type) diff --git a/vlib/v/checker/match.v b/vlib/v/checker/match.v index b3eccd7374..ae03dea745 100644 --- a/vlib/v/checker/match.v +++ b/vlib/v/checker/match.v @@ -166,7 +166,7 @@ fn (mut c Checker) match_exprs(mut node ast.MatchExpr, cond_type_sym ast.TypeSym c.error('mismatched range types', low_expr.pos) } } else if low_expr is ast.CharLiteral { - if high_expr is ast.CharLiteral && cond_type_sym.kind in [.byte, .char, .rune] { + if high_expr is ast.CharLiteral && cond_type_sym.kind in [.u8, .char, .rune] { low = low_expr.val[0] high = high_expr.val[0] if low > high { diff --git a/vlib/v/gen/c/auto_str_methods.v b/vlib/v/gen/c/auto_str_methods.v index 63abb12c72..cc7c3c3e4f 100644 --- a/vlib/v/gen/c/auto_str_methods.v +++ b/vlib/v/gen/c/auto_str_methods.v @@ -574,7 +574,7 @@ fn (mut g Gen) gen_str_for_array(info ast.Array, styp string, str_fn_name string is_elem_ptr := typ.is_ptr() sym_has_str_method, str_method_expects_ptr, _ := sym.str_method_info() mut elem_str_fn_name := g.get_str_fn(typ) - if sym.kind == .byte { + if sym.kind == .u8 { elem_str_fn_name = elem_str_fn_name + '_escaped' } diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 4a0880a1d7..e2976328dd 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -2738,7 +2738,7 @@ fn (mut g Gen) map_fn_ptrs(key_typ ast.TypeSymbol) (string, string, string, stri mut clone_fn := '' mut free_fn := '&map_free_nop' match key_typ.kind { - .byte, .i8, .char { + .u8, .i8, .char { hash_fn = '&map_hash_int_1' key_eq_fn = '&map_eq_int_1' clone_fn = '&map_clone_int_1' @@ -5081,7 +5081,7 @@ fn (mut g Gen) type_default(typ_ ast.Type) string { for field in info.fields { field_sym := g.table.sym(field.typ) if field.has_default_expr - || field_sym.kind in [.array, .map, .string, .bool, .alias, .i8, .i16, .int, .i64, .byte, .u16, .u32, .u64, .char, .voidptr, .byteptr, .charptr, .struct_] { + || field_sym.kind in [.array, .map, .string, .bool, .alias, .i8, .i16, .int, .i64, .u8, .u16, .u32, .u64, .char, .voidptr, .byteptr, .charptr, .struct_] { field_name := c_name(field.name) if field.has_default_expr { mut expr_str := '' @@ -5642,7 +5642,7 @@ pub fn (mut g Gen) contains_ptr(el_typ ast.Type) bool { return true } match sym.kind { - .i8, .i16, .int, .i64, .byte, .u16, .u32, .u64, .f32, .f64, .char, .rune, .bool, .enum_ { + .i8, .i16, .int, .i64, .u8, .u16, .u32, .u64, .f32, .f64, .char, .rune, .bool, .enum_ { return false } .array_fixed { diff --git a/vlib/v/gen/c/embed.v b/vlib/v/gen/c/embed.v index a32d37a675..ce4778fbc8 100644 --- a/vlib/v/gen/c/embed.v +++ b/vlib/v/gen/c/embed.v @@ -47,7 +47,7 @@ fn (mut g Gen) gen_embed_file_init(mut node ast.ComptimeCall) { eprintln('unable to read compressed file') { } - []byte{} + []u8{} } os.rm(cache_path) or {} // clean up node.embed_file.is_compressed = compressed_bytes.len > 0 diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 76c6f3f6de..7ab644576a 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -2884,7 +2884,7 @@ fn (mut p Parser) string_expr() ast.Expr { mut precisions := []int{} mut visible_pluss := []bool{} mut fills := []bool{} - mut fmts := []byte{} + mut fmts := []u8{} mut fposs := []token.Pos{} // Handle $ interpolation p.inside_str_interp = true