From 8abf69389e166180d4ad2db2ab253e4b7fda7668 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 11 Mar 2026 14:49:48 +0300 Subject: [PATCH] all: more test fixes --- vlib/builtin/chan_option_result.v | 4 ++++ vlib/v/gen/c/cgen.v | 2 +- vlib/v/gen/c/fn.v | 2 +- vlib/v/gen/wasm/tests/arith.vv | 2 +- .../prohibit_redeclaration_of_builtin_types.out | 12 ++++++------ vlib/v/pref/pref_test.v | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/vlib/builtin/chan_option_result.v b/vlib/builtin/chan_option_result.v index 8b3ede61b..8f1e604a0 100644 --- a/vlib/builtin/chan_option_result.v +++ b/vlib/builtin/chan_option_result.v @@ -59,6 +59,10 @@ pub fn (err IError) str() string { if err is None__ { return 'none' } + c := err.code() + if c > 0 { + return err.msg() + '; code: ' + c.str() + } return err.msg() } diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 40428466e..5c8f93b25 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -4403,7 +4403,7 @@ fn (mut g Gen) typeof_expr(node ast.TypeOf) { if sym.kind == .sum_type { // When encountering a .sum_type, typeof() should be done at runtime, // because the subtype of the expression may change: - g.write('builtin__charptr_vstring_literal(v_typeof_sumtype_${sym.cname}( (') + g.write('builtin__tos3(v_typeof_sumtype_${sym.cname}( (') if typ.nr_muls() > 0 { g.write('*'.repeat(typ.nr_muls())) } diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index 0a632c07b..1086d6518 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -1692,7 +1692,7 @@ fn (mut g Gen) method_call(node ast.CallExpr) { match node.kind { .type_name { if left_sym.kind in [.sum_type, .interface] { - g.conversion_function_call('builtin__charptr_vstring_literal(v_typeof_${prefix_name}_${typ_sym.cname}', + g.conversion_function_call('builtin__tos3(v_typeof_${prefix_name}_${typ_sym.cname}', ')', node) return } diff --git a/vlib/v/gen/wasm/tests/arith.vv b/vlib/v/gen/wasm/tests/arith.vv index 413d69dc4..a676100e9 100644 --- a/vlib/v/gen/wasm/tests/arith.vv +++ b/vlib/v/gen/wasm/tests/arith.vv @@ -3,7 +3,7 @@ fn mul(a i64, unsigned u32) f64 { one *= 2 / unsigned - return one + return f64(one) } fn typ(a int) i64 { diff --git a/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.out b/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.out index e18f6d57b..2800d404b 100644 --- a/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.out +++ b/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.out @@ -1,10 +1,10 @@ vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.vv:1:8: error: cannot register struct `Option`, another type with this name exists 1 | struct Option {} | ~~~~~~ -Details: vlib/builtin/chan_option_result.v:133:8: details: another declaration was found here - 131 | - 132 | // Option is the base of V's internal option return system. - 133 | struct Option { +Details: vlib/builtin/chan_option_result.v:137:8: details: another declaration was found here + 135 | + 136 | // Option is the base of V's internal option return system. + 137 | struct Option { | ~~~~~~ - 134 | state u8 // 0 - ok; 2 - none; 1 - ? - 135 | err IError = none__ + 138 | state u8 // 0 - ok; 2 - none; 1 - ? + 139 | err IError = none__ diff --git a/vlib/v/pref/pref_test.v b/vlib/v/pref/pref_test.v index 962eb5279..f181323a5 100644 --- a/vlib/v/pref/pref_test.v +++ b/vlib/v/pref/pref_test.v @@ -38,7 +38,7 @@ fn test_version_flag() { } fn test_cross_compile_keeps_explicit_cc() { - target_os := if pref.get_host_os() == .windows { 'linux' } else { 'windows' } + target_os := if pref.get_host_os() == .linux { 'macos' } else { 'linux' } custom_cc := 'cosmocc' first, _ := pref.parse_args_and_show_errors(['help'], ['', '-cc', custom_cc, '-os', target_os], -- 2.39.5