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

checker: fix generic_mutable_arrays in functions (#8445)

This commit is contained in:
BigBlack
2021-01-31 01:35:03 +08:00
committed by GitHub
parent 64d12cdc8d
commit c5e7956eb5
2 changed files with 10 additions and 1 deletions

View File

@@ -1359,3 +1359,12 @@ fn test_clone_of_same_elem_size_array() {
println(arr2)
assert arr2 == [Abc{1, 2, 3}, Abc{2, 3, 4}]
}
pub fn example<T>(mut arr []T) []T {
return arr.clone()
}
fn test_generic_mutable_arrays() {
mut arr := [1, 2, 3]
assert example(mut arr) == [1, 2, 3]
}