mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
make _V_mret_ unique by putting p.token_idx in it
This commit is contained in:
parent
729f9c3391
commit
e31d892598
3 changed files with 74 additions and 32 deletions
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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue