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

checker: error on a.slice(x,y) outside builtin

This commit is contained in:
Delyan Angelov
2021-01-19 14:34:25 +02:00
parent 129eee346b
commit d9532eda30
7 changed files with 41 additions and 24 deletions

View File

@ -255,9 +255,9 @@ fn test_left() {
fn test_slice() {
a := [1, 2, 3, 4]
b := a.slice(2, 4)
b := a[2..4]
assert b.len == 2
assert a.slice(1, 2).len == 1
assert a[1..2].len == 1
assert a.len == 4
}
@ -355,7 +355,7 @@ fn test_clone() {
assert nums2.len == 5
assert nums.str() == '[1, 2, 3, 4, 100]'
assert nums2.str() == '[1, 2, 3, 4, 100]'
assert nums.slice(1, 3).str() == '[2, 3]'
assert nums[1..3].str() == '[2, 3]'
}
/*