1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: do not allow arr1=arr2 without cloning

This commit is contained in:
Alexander Medvednikov
2020-12-20 15:33:55 +01:00
parent 583c02316a
commit 6bf21c300a
5 changed files with 8 additions and 7 deletions

View File

@ -359,6 +359,7 @@ fn test_clone() {
assert nums.slice(1, 3).str() == '[2, 3]'
}
/*
fn test_copy() {
a := [1, 2, 3]
b := a
@ -366,7 +367,7 @@ fn test_copy() {
assert b[1] == 2
assert b[2] == 3
}
*/
fn test_mutli_array_clone() {
// 2d array_int
mut a2_1 := [[1, 2, 3], [4, 5, 6]]
@ -683,7 +684,7 @@ fn test_array_str() {
numbers := [1, 2, 3]
assert numbers == [1, 2, 3]
numbers2 := [numbers, [4, 5, 6]] // dup str() bug
_ = numbers2
println(numbers2)
assert true
assert numbers.str() == '[1, 2, 3]'
// QTODO