cgen: fix cross assign with mutable args (fix #5609 #5610 #5611) (#5614)

This commit is contained in:
yuyi 2020-07-02 17:09:26 +08:00 committed by GitHub
parent c21527d3c6
commit 6cbc0e84f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 91 additions and 37 deletions

View file

@ -877,16 +877,3 @@ fn test_plus_assign_string() {
a[0] += 'abc'
assert a == ['abc']
}
fn test_cross_assign() {
mut a := [0, 1]
a[0], a[1] = a[1], a[0]
assert a[0] == 1
assert a[1] == 0
mut b1 := [1, 2, 3]
mut b2 := 4
b1[2], b2, b1[0] = b1[0], b1[2], 5
assert b1 == [5, 2, 1]
assert b2 == 3
}