1
Fork 0

Move to short kind kinds words in test suite

Issue #1076
This commit is contained in:
Marijn Haverbeke 2011-10-28 14:57:49 +02:00
parent cba4ddc6a4
commit 3397fa4701
14 changed files with 39 additions and 39 deletions

View file

@ -55,25 +55,25 @@ mod map_reduce {
export reducer;
export map_reduce;
type putter<unique K, unique V> = fn(K, V);
type putter<uniq K, uniq V> = fn(K, V);
// FIXME: the first K1 parameter should probably be a -, but that
// doesn't parse at the moment.
type mapper<unique K1, unique K2, unique V> = fn(K1, putter<K2, V>);
type mapper<uniq K1, uniq K2, uniq V> = fn(K1, putter<K2, V>);
type getter<unique V> = fn() -> option<V>;
type getter<uniq V> = fn() -> option<V>;
type reducer<unique K, unique V> = fn(K, getter<V>);
type reducer<uniq K, uniq V> = fn(K, getter<V>);
tag ctrl_proto<unique K, unique V> {
tag ctrl_proto<uniq K, uniq V> {
find_reducer(K, chan<chan<reduce_proto<V>>>);
mapper_done;
}
tag reduce_proto<unique V> { emit_val(V); done; ref; release; }
tag reduce_proto<uniq V> { emit_val(V); done; ref; release; }
fn start_mappers<unique K1, unique K2,
unique V>(map: mapper<K1, K2, V>,
fn start_mappers<uniq K1, uniq K2,
uniq V>(map: mapper<K1, K2, V>,
ctrl: chan<ctrl_proto<K2, V>>, inputs: [K1]) ->
[joinable_task] {
let tasks = [];
@ -84,15 +84,15 @@ mod map_reduce {
ret tasks;
}
fn map_task<unique K1, unique K2,
unique V>(-map: mapper<K1, K2, V>,
fn map_task<uniq K1, uniq K2,
uniq V>(-map: mapper<K1, K2, V>,
-ctrl: chan<ctrl_proto<K2, V>>,
-input: K1) {
// log_err "map_task " + input;
let intermediates = treemap::init();
fn emit<unique K2,
unique V>(im: treemap::treemap<K2, chan<reduce_proto<V>>>,
fn emit<uniq K2,
uniq V>(im: treemap::treemap<K2, chan<reduce_proto<V>>>,
ctrl: chan<ctrl_proto<K2, V>>, key: K2, val: V) {
let c;
alt treemap::find(im, key) {
@ -110,15 +110,15 @@ mod map_reduce {
map(input, bind emit(intermediates, ctrl, _, _));
fn finish<unique K, unique V>(_k: K, v: chan<reduce_proto<V>>) {
fn finish<uniq K, uniq V>(_k: K, v: chan<reduce_proto<V>>) {
send(v, release);
}
treemap::traverse(intermediates, finish);
send(ctrl, mapper_done);
}
fn reduce_task<unique K,
unique V>(-reduce: reducer<K, V>, -key: K,
fn reduce_task<uniq K,
uniq V>(-reduce: reducer<K, V>, -key: K,
-out: chan<chan<reduce_proto<V>>>) {
let p = port();
@ -127,7 +127,7 @@ mod map_reduce {
let ref_count = 0;
let is_done = false;
fn get<unique V>(p: port<reduce_proto<V>>,
fn get<uniq V>(p: port<reduce_proto<V>>,
&ref_count: int, &is_done: bool)
-> option<V> {
while !is_done || ref_count > 0 {
@ -150,8 +150,8 @@ mod map_reduce {
reduce(key, bind get(p, ref_count, is_done));
}
fn map_reduce<unique K1, unique K2,
unique V>(map: mapper<K1, K2, V>, reduce: reducer<K2, V>,
fn map_reduce<uniq K1, uniq K2,
uniq V>(map: mapper<K1, K2, V>, reduce: reducer<K2, V>,
inputs: [K1]) {
let ctrl = port();
@ -194,7 +194,7 @@ mod map_reduce {
}
}
fn finish<unique K, unique V>(_k: K, v: chan<reduce_proto<V>>) {
fn finish<uniq K, uniq V>(_k: K, v: chan<reduce_proto<V>>) {
send(v, done);
}
treemap::traverse(reducers, finish);

View file

@ -4,7 +4,7 @@ resource r(i: @mutable int) {
*i = *i + 1;
}
fn movearg<pinned T>(i: T) {
fn movearg<pin T>(i: T) {
// Implicit copy to mutate reference i
let j <- i;
}

View file

@ -1,6 +1,6 @@
// error-pattern: needed unique type
fn f<unique T>(i: T) {
fn f<uniq T>(i: T) {
}
fn main() {

View file

@ -1,5 +1,5 @@
// error-pattern: Unsatisfied precondition constraint
fn send<unique T>(ch: _chan<T>, -data: T) { log ch; log data; fail; }
fn send<uniq T>(ch: _chan<T>, -data: T) { log ch; log data; fail; }
type _chan<T> = int;
// Tests that "log message;" is flagged as using

View file

@ -4,8 +4,8 @@ fn test00_start(ch: chan_t<int>, message: int) { send(ch, message); }
type task_id = int;
type port_id = int;
type chan_t<unique T> = {task: task_id, port: port_id};
type chan_t<uniq T> = {task: task_id, port: port_id};
fn send<unique T>(ch: chan_t<T>, -data: T) { fail; }
fn send<uniq T>(ch: chan_t<T>, -data: T) { fail; }
fn main() { fail "quux"; }

View file

@ -5,7 +5,7 @@ import std::comm::port;
import std::comm::send;
import std::comm::recv;
fn echo<unique T>(c: chan<T>, oc: chan<chan<T>>) {
fn echo<uniq T>(c: chan<T>, oc: chan<chan<T>>) {
// Tests that the type argument in port gets
// visited
let p = port::<T>();

View file

@ -1,8 +1,8 @@
fn fix_help<A, unique B>(f: fn(fn@(A) -> B, A) -> B, x: A) -> B {
fn fix_help<A, uniq B>(f: fn(fn@(A) -> B, A) -> B, x: A) -> B {
ret f(bind fix_help(f, _), x);
}
fn fix<A, unique B>(f: fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
fn fix<A, uniq B>(f: fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
ret bind fix_help(f, _);
}

View file

@ -1,6 +1,6 @@
// This is what the signature to spawn should look like with bare functions
fn spawn<unique T>(val: T, f: fn(T)) {
fn spawn<uniq T>(val: T, f: fn(T)) {
f(val);
}

View file

@ -1,6 +1,6 @@
fn id<unique T>(t: T) -> T { ret t; }
fn id<uniq T>(t: T) -> T { ret t; }
fn main() {
let expected = ~100;

View file

@ -5,7 +5,7 @@ type closable = @mutable bool;
resource close_res(i: closable) { *i = false; }
tag option<pinned T> { none; some(T); }
tag option<pin T> { none; some(T); }
fn sink(res: option<close_res>) { }

View file

@ -4,9 +4,9 @@ import std::comm::send;
import std::comm::port;
// tests that ctrl's type gets inferred properly
type command<unique K, unique V> = {key: K, val: V};
type command<uniq K, uniq V> = {key: K, val: V};
fn cache_server<unique K, unique V>(c: chan<chan<command<K, V>>>) {
fn cache_server<uniq K, uniq V>(c: chan<chan<command<K, V>>>) {
let ctrl = port();
send(c, chan(ctrl));
}

View file

@ -1,6 +1,6 @@
fn p_foo<T>(pinned: T) { }
fn p_foo<pin T>(pinned: T) { }
fn s_foo<T>(shared: T) { }
fn u_foo<unique T>(unique: T) { }
fn u_foo<uniq T>(unique: T) { }
resource r(i: int) { }

View file

@ -1,10 +1,10 @@
fn unique() {
fn f<unique T>(i: T, j: T) {
fn f<uniq T>(i: T, j: T) {
assert i == j;
}
fn g<unique T>(i: T, j: T) {
fn g<uniq T>(i: T, j: T) {
assert i != j;
}
@ -36,11 +36,11 @@ fn shared() {
fn pinned() {
fn f<T>(i: T, j: T) {
fn f<pin T>(i: T, j: T) {
assert i == j;
}
fn g<T>(i: T, j: T) {
fn g<pin T>(i: T, j: T) {
assert i != j;
}

View file

@ -80,7 +80,7 @@ fn test_join_convenient() {
#[ignore]
fn spawn_polymorphic() {
// FIXME #1038: Can't spawn palymorphic functions
/*fn foo<unique T>(x: T) { log_err x; }
/*fn foo<uniq T>(x: T) { log_err x; }
task::spawn(true, foo);
task::spawn(42, foo);*/