Skip to content

Commit c5aa74c

Browse files
committed
v3: fix post-merge CI regressions
1 parent 8af7a8e commit c5aa74c

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

vlib/v3/tests/review_transform_regressions_test.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5460,7 +5460,7 @@ fn main() {
54605460
println(value.str())
54615461
}
54625462
')
5463-
assert out == 'alpha'
5463+
assert out == '&alpha'
54645464
}
54655465

54665466
fn test_struct_literal_implicit_reference_and_option_or_mut_receiver() {

vlib/v3/tests/veb_html_dynamic_path_codegen_test.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn test_veb_html_dynamic_path_is_rejected_not_handler_template() {
3838
os.write_file(os.join_path(root, 'dyn.v'), vhd_app_source('\$veb.html(name)')) or { panic(err) }
3939
dyn_c := os.join_path(root, 'dyn.c')
4040
os.rm(dyn_c) or {}
41-
dyn := os.execute('${v3_bin} ${os.join_path(root, 'dyn.v')} -o ${dyn_c}')
41+
dyn := os.execute('${v3_bin} -no-memory-limit ${os.join_path(root, 'dyn.v')} -o ${dyn_c}')
4242
assert dyn.exit_code != 0, 'a non-compile-time `\$veb.html(path)` must be rejected, got:\n${dyn.output}'
4343
dyn_code := os.read_file(dyn_c) or { '' }
4444
assert !dyn_code.contains('HANDLER_TEMPLATE'), 'dynamic path must not resolve to the handler template'
@@ -47,7 +47,7 @@ fn test_veb_html_dynamic_path_is_rejected_not_handler_template() {
4747
os.write_file(os.join_path(root, 'noarg.v'), vhd_app_source('\$veb.html()')) or { panic(err) }
4848
noarg_c := os.join_path(root, 'noarg.c')
4949
os.rm(noarg_c) or {}
50-
noarg := os.execute('${v3_bin} ${os.join_path(root, 'noarg.v')} -o ${noarg_c}')
50+
noarg := os.execute('${v3_bin} -no-memory-limit ${os.join_path(root, 'noarg.v')} -o ${noarg_c}')
5151
assert noarg.exit_code == 0, noarg.output
5252
noarg_code := os.read_file(noarg_c) or { '' }
5353
assert noarg_code.contains('HANDLER_TEMPLATE'), 'the no-arg form should render the handler template'

vlib/v3/tests/veb_html_requires_call_codegen_test.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn test_veb_html_requires_call_syntax() {
3838
os.write_file(os.join_path(root, 'ok.v'), vhrc_app_source('\$veb.html()')) or { panic(err) }
3939
ok_c := os.join_path(root, 'ok.c')
4040
os.rm(ok_c) or {}
41-
ok := os.execute('${v3_bin} ${os.join_path(root, 'ok.v')} -o ${ok_c}')
41+
ok := os.execute('${v3_bin} -no-memory-limit ${os.join_path(root, 'ok.v')} -o ${ok_c}')
4242
assert ok.exit_code == 0, ok.output
4343
ok_code := os.read_file(ok_c) or { '' }
4444
assert ok_code.contains('HELLO_TMPL'), 'the call form should render the handler template'
@@ -47,7 +47,7 @@ fn test_veb_html_requires_call_syntax() {
4747
os.write_file(os.join_path(root, 'bad.v'), vhrc_app_source('\$veb.html')) or { panic(err) }
4848
bad_c := os.join_path(root, 'bad.c')
4949
os.rm(bad_c) or {}
50-
bad := os.execute('${v3_bin} ${os.join_path(root, 'bad.v')} -o ${bad_c}')
50+
bad := os.execute('${v3_bin} -no-memory-limit ${os.join_path(root, 'bad.v')} -o ${bad_c}')
5151
assert bad.exit_code != 0, 'bare `\$veb.html` without a call must be rejected, got:\n${bad.output}'
5252
bad_code := os.read_file(bad_c) or { '' }
5353
assert !bad_code.contains('HELLO_TMPL'), 'bare `\$veb.html` must not render the handler template'

vlib/v3/transform/array.v

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ fn (mut t Transformer) try_lower_array_repeat_call(_id flat.NodeId, node flat.No
9494
return t.make_call_expr_typed(selector, [count, t.make_int_literal(depth)], node.typ)
9595
}
9696

97-
// make_plain_array_repeat_value preserves the repeated result before destroying a
98-
// non-addressable source array whose backing storage was materialized after ownership
99-
// analysis.
97+
// make_plain_array_repeat_value preserves the repeated result before freeing the backing
98+
// storage of a non-addressable source array materialized after ownership analysis. The
99+
// repeated result owns the shallow-copied elements, so the source elements must not be dropped.
100100
fn (mut t Transformer) make_plain_array_repeat_value(base_id flat.NodeId, count_id flat.NodeId, array_type string) flat.NodeId {
101101
source := t.transform_expr(base_id)
102102
stable_source := t.stable_transformed_expr_for_reuse(source, array_type,
@@ -108,9 +108,7 @@ fn (mut t Transformer) make_plain_array_repeat_value(base_id flat.NodeId, count_
108108
array_type)
109109
out_name := t.new_temp('plain_array_repeat')
110110
t.pending_stmts << t.make_decl_assign_typed(out_name, repeated, array_type)
111-
t.pending_stmts << t.make_expr_stmt(t.make_call_typed('drop_owned', [
112-
stable_source,
113-
], 'void'))
111+
t.pending_stmts << t.make_expr_stmt(t.make_method_call(stable_source, 'free', []flat.NodeId{}))
114112
result := t.make_ident(out_name)
115113
t.set_node_typ(int(result), array_type)
116114
return result

vlib/v3/transform/monomorphize.v

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9592,6 +9592,9 @@ fn (mut t Transformer) generic_comptime_typeof_target(node flat.Node, args []str
95929592
}
95939593
}
95949594
target := t.generic_comptime_base_type(child_id, args) or { return none }
9595+
if child.kind == .ident && t.mut_param_values[child.value] && !target.starts_with('&') {
9596+
return '&${target}'
9597+
}
95959598
return target
95969599
}
95979600

0 commit comments

Comments
 (0)