mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
make _V_mret_ unique by putting p.token_idx in it
This commit is contained in:

committed by
Alexander Medvednikov

parent
729f9c3391
commit
e31d892598
27
vlib/compiler/tests/reusable_mut_multiret_values_test.v
Normal file
27
vlib/compiler/tests/reusable_mut_multiret_values_test.v
Normal file
@@ -0,0 +1,27 @@
|
||||
// verify fix for #2913
|
||||
|
||||
fn some_multiret_fn(a int, b int) (int, int) {
|
||||
return a+1, b+1
|
||||
}
|
||||
|
||||
fn test_reuse_multiple_multiret() {
|
||||
mut c, mut d := some_multiret_fn(4,10)
|
||||
|
||||
mut a, mut b := some_multiret_fn(c,d)
|
||||
assert a == c+1
|
||||
assert b == d+1
|
||||
|
||||
for i in 1..10 {
|
||||
c += i
|
||||
d += i
|
||||
a, b = some_multiret_fn(c,d)
|
||||
assert a == c+1
|
||||
assert b == d+1
|
||||
|
||||
c += i+1
|
||||
d += i+1
|
||||
a, b = some_multiret_fn(c,d)
|
||||
assert a == c+1
|
||||
assert b == d+1
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user