Skip to content

Commit 8789cc4

Browse files
authored
v.ast: fix fmt of 'bytestr' to '&byte' (#12014)
1 parent d39fec3 commit 8789cc4

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

cmd/tools/vtest-cleancode.v

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ const (
3131
'vlib/sqlite/orm.v' /* mut c &int -> mut c int */,
3232
'vlib/builtin/int_test.v' /* special number formatting that should be tested */,
3333
// TODOs and unfixed vfmt bugs
34-
'vlib/builtin/int.v' /* TODO byteptr: vfmt converts `pub fn (nn byteptr) str() string {` to `nn &byte` and that conflicts with `nn byte` */,
35-
'vlib/builtin/string_charptr_byteptr_helpers.v' /* TODO byteptr: a temporary shim to ease the byteptr=>&byte transition */,
3634
'vlib/v/tests/interop_test.v', /* bad comment formatting */
3735
'vlib/v/gen/js/tests/js.v', /* local `hello` fn, gets replaced with module `hello` aliased as `hl` */
3836
]

vlib/builtin/int.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ pub fn (nn i8) hex() string {
313313
return '00'
314314
}
315315
return u64_to_hex(u64(nn), 2)
316-
//return byte(nn).hex()
317316
}
318317

319318
// hex returns the value of the `u16` as a hexadecimal `string`.

vlib/v/ast/types.v

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -948,17 +948,9 @@ pub fn (t &Table) type_to_str_using_aliases(typ Type, import_aliases map[string]
948948
// *clearly*, and that when a new kind is added, it should also be handled
949949
// explicitly.
950950
match sym.kind {
951-
.int_literal, .float_literal {
952-
res = sym.name
953-
}
954-
.byteptr {
955-
res = '&byte'
956-
}
957-
.charptr {
958-
res = '&char'
959-
}
951+
.int_literal, .float_literal {}
960952
.i8, .i16, .int, .i64, .isize, .byte, .u8, .u16, .u32, .u64, .usize, .f32, .f64, .char,
961-
.rune, .string, .bool, .none_, .voidptr {
953+
.rune, .string, .bool, .none_, .voidptr, .byteptr, .charptr {
962954
// primitive types
963955
res = sym.kind.str()
964956
}

0 commit comments

Comments
 (0)