wrap up the new mut check

pull/1308/head
Alexander Medvednikov 2019-07-25 14:13:35 +02:00
parent ceb0139329
commit 2ac579ca0a
5 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,7 @@
- @ for escaping keywords (e.g. `struct Foo { @type string }`).
- Windows Unicode fixes (V can now work with non-ASCII paths etc on Windows).
- Fix mutable args bugs + don't allow primitive arguments to be modified.
- Declaring a mutable variable and never modifying it results in a compilation error.
## V 0.1.16

View File

@ -226,7 +226,7 @@ fn (g mut Game) delete_completed_line(y int) {
for yy := y - 1; yy >= 1; yy-- {
for x := 1; x <= FieldWidth; x++ {
mut a := g.field[yy + 1]
mut b := g.field[yy]
b := g.field[yy]
a[x] = b[x]
}
}

View File

@ -109,7 +109,7 @@ fn test_repeat() {
assert aa[9] == f32(1.1)
}
{
mut aa := [f64(1.1) ; 10]
aa := [f64(1.1) ; 10]
assert aa[0] == f64(1.1)
assert aa[5] == f64(1.1)
assert aa[9] == f64(1.1)

View File

@ -141,7 +141,7 @@ fn test_clone() {
a += 'a'
a += 'a'
b := a
mut c := a.clone()
c := a.clone()
assert c == a
assert c == 'aaa'
assert b == 'aaa'

View File

@ -256,4 +256,5 @@ fn test_passing_empty() {
assert stats.min(data) == f64(0)
assert stats.max(data) == f64(0)
assert stats.range(data) == f64(0)
}