mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast: fix formatting fn variadic of reference param (#11130)
This commit is contained in:
27
vlib/v/fmt/tests/vargs_reference_param_keep.vv
Normal file
27
vlib/v/fmt/tests/vargs_reference_param_keep.vv
Normal file
@ -0,0 +1,27 @@
|
||||
[heap]
|
||||
struct Foo {
|
||||
name string
|
||||
}
|
||||
|
||||
fn agg_stuff(stuffs ...&Foo) []&Foo {
|
||||
stuffs2 := stuffs.clone()
|
||||
return stuffs2
|
||||
}
|
||||
|
||||
fn arr_stuff(stuffs []&Foo) []&Foo {
|
||||
stuffs2 := stuffs.clone()
|
||||
return stuffs2
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo1 := &Foo{'foo'}
|
||||
foo2 := &Foo{'bar'}
|
||||
|
||||
foo11 := agg_stuff(foo1, foo2)
|
||||
println(foo11)
|
||||
|
||||
foo22 := arr_stuff([foo1, foo2])
|
||||
println(foo22)
|
||||
|
||||
assert '$foo11' == '$foo22'
|
||||
}
|
Reference in New Issue
Block a user