Improve mutability checking. Closes #118.

This commit is contained in:
Graydon Hoare 2010-07-23 15:29:17 -07:00
parent 8bd8413906
commit 44e2dc2789
9 changed files with 60 additions and 15 deletions

View file

@ -1,6 +1,6 @@
// -*- rust -*-
// error-pattern: writing to non-mutable slot
// error-pattern: writing to immutable type
type point = rec(int x, int y, int z);

View file

@ -0,0 +1,8 @@
// error-pattern: writing to immutable type
obj objy(int x) {
fn foo() -> () {
x = 5;
}
}
fn main() {
}

View file

@ -0,0 +1,5 @@
// error-pattern: writing to immutable type
fn main() {
let rec(int x) r = rec(x=1);
r.x = 6;
}

View file

@ -0,0 +1,5 @@
// error-pattern: writing to immutable type
fn main() {
let tup(int) t = tup(1);
t._0 = 5;
}

View file

@ -0,0 +1,5 @@
// error-pattern: writing to immutable type
fn main() {
let vec[int] v = vec(1, 2, 3);
v.(1) = 4;
}