Convert most working tests to ivecs

I tried to pay attention to what was actually being tested so, e.g. when I
test was just using a vec as a boxed thing, I converted to boxed ints, etc.

Haven't converted the macro tests yet. Not sure what to do there.
This commit is contained in:
Brian Anderson 2011-08-12 15:42:39 -07:00
parent 594c7fb0c6
commit ee7d03f7d7
56 changed files with 124 additions and 121 deletions

View file

@ -1,2 +1,2 @@
// error-pattern:expected str but found vec
fn main() { fail []; }
// error-pattern:expected str but found [int]
fn main() { fail ~[0]; }

View file

@ -1,6 +1,6 @@
// -*- rust -*-
// error-pattern: illegal recursive type
type x = vec[x];
type x = [x];
fn main() { let b: x = []; }
fn main() { let b: x = ~[]; }

View file

@ -1,5 +1,5 @@
// error-pattern:Attempt to use a type argument out of scope
fn hd[U](v: &vec[U]) -> U {
fn hd1(w: &vec[U]) -> U { ret w.(0); }
fn hd[U](v: &[U]) -> U {
fn hd1(w: &[U]) -> U { ret w.(0); }
ret hd1(v);
}

View file

@ -6,7 +6,7 @@ import std::option::some;
// error-pattern: mismatched types
tag bar { t1((), option::t[vec[int]]); t2; }
tag bar { t1((), option::t[[int]]); t2; }
fn foo(t: bar) -> int { alt t { t1(_, some(x)) { ret x * 3; } _ { fail; } } }

View file

@ -5,7 +5,7 @@ import std::option::some;
// error-pattern: mismatched types
tag bar { t1((), option::t[vec[int]]); t2; }
tag bar { t1((), option::t[[int]]); t2; }
fn foo(t: bar) { alt t { t1(_, some[int](x)) { log x; } _ { fail; } } }

View file

@ -1,15 +1,15 @@
// -*- rust -*-
// error-pattern:src/test/compile-fail/shadow.rs
fn foo(c: vec[int]) {
fn foo(c: [int]) {
let a: int = 5;
let b: vec[int] = [];
let b: [int] = ~[];
alt none[int] {
some[int](_) { for i: int in c { log a; let a = 17; b += [a]; } }
some[int](_) { for i: int in c { log a; let a = 17; b += ~[a]; } }
}
}
tag t[T] { none; some(T); }
fn main() { foo([]); }
fn main() { foo(~[]); }

View file

@ -1,6 +1,6 @@
// error-pattern:invalidate alias x
fn main() {
let v: vec[mutable int] = [mutable 1, 2, 3];
let v: [mutable int] = ~[mutable 1, 2, 3];
for x: int in v { v.(0) = 10; log x; }
}

View file

@ -1,8 +1,8 @@
// error-pattern:attempted field access on type vec[int]
// error-pattern:attempted field access on type [int]
// issue #367
fn f() {
let v = [1];
let v = ~[1];
log v.some_field_name; //type error
}

View file

@ -1,5 +1,5 @@
// error-pattern: Unsatisfied precondition constraint
fn test() { let w: vec[int]; w.(5) = 0; }
fn test() { let w: [int]; w.(5) = 0; }
fn main() { test(); }

View file

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