mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: fix a bug with mutable array args
This commit is contained in:
@ -177,3 +177,15 @@ fn test_fixed() {
|
||||
nums2 := [N]int
|
||||
assert nums2[N - 1] == 0
|
||||
}
|
||||
|
||||
fn modify (numbers mut []int) {
|
||||
numbers[0] = 777
|
||||
}
|
||||
|
||||
fn test_mut_slice() {
|
||||
mut n := [1,2,3]
|
||||
modify(mut n.left(2))
|
||||
assert n[0] == 777
|
||||
println(n)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user