Remove tests for objs, adjust tests that use objs

This commit is contained in:
Marijn Haverbeke 2012-01-13 11:48:55 +01:00
parent 24102d50ad
commit d2be5b6c7a
58 changed files with 16 additions and 971 deletions

View File

@ -159,7 +159,6 @@ fn doc_item(rd: rustdoc, item: @ast::item) {
ast::item_mod(_mod) { }
ast::item_ty(ty, typarams) { }
ast::item_tag(variant, typarams) { }
ast::item_obj(_obj, typarams, node_id) { }
ast::item_res(_, _, _, _, _) { }
};
}

View File

@ -13,12 +13,11 @@ import str;
fn LINE_LENGTH() -> uint { ret 60u; }
obj myrandom(mutable last: u32) {
fn next(mx: u32) -> u32 {
last = (last * 3877u32 + 29573u32) % 139968u32;
let ans = mx * last / 139968u32;
ret ans;
}
type myrandom = @{mutable last: u32};
fn myrandom_next(r: myrandom, mx: u32) -> u32 {
r.last = (r.last * 3877u32 + 29573u32) % 139968u32;
mx * r.last / 139968u32
}
type aminoacids = {ch: char, prob: u32};
@ -45,10 +44,11 @@ fn select_random(r: u32, genelist: [aminoacids]) -> char {
fn make_random_fasta(id: str, desc: str, genelist: [aminoacids], n: int) {
log(debug, ">" + id + " " + desc);
let rng = myrandom(std::rand::mk_rng().next());
let rng = @{mutable last: std::rand::mk_rng().next()};
let op: str = "";
uint::range(0u, n as uint) {|i|
str::push_byte(op, select_random(rng.next(100u32), genelist) as u8);
uint::range(0u, n as uint) {|_i|
str::push_byte(op, select_random(myrandom_next(rng, 100u32),
genelist) as u8);
if str::byte_len(op) >= LINE_LENGTH() {
log(debug, op);
op = "";
@ -73,7 +73,7 @@ fn make_repeat_fasta(id: str, desc: str, s: str, n: int) {
fn acid(ch: char, prob: u32) -> aminoacids { ret {ch: ch, prob: prob}; }
fn main(args: [str]) {
fn main() {
let iub: [aminoacids] =
make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32),
acid('t', 27u32), acid('B', 2u32), acid('D', 2u32),

View File

@ -1,22 +0,0 @@
//error-pattern: with one of a different type
use std;
fn main() {
obj a() {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
}
let my_a = a();
// Attempting to override a method with one of a different type.
let my_b =
obj () {
fn foo() -> str { ret "hello"; }
with
my_a
};
log(error, my_b.foo());
}

View File

@ -1,5 +1,5 @@
// error-pattern: attempted dynamic environment-capture
obj foo(x: int) {
fn foo(x: int) {
fn mth() {
fn bar() { log(debug, x); }
}

View File

@ -1,6 +1,6 @@
// xfail-test
// error-pattern: attempted dynamic environment-capture
fn foo<T>() {
obj bar(b: T) { }
fn bar(b: T) { }
}
fn main() { }

View File

@ -1,3 +0,0 @@
// error-pattern:- cannot be applied to type `obj
fn main() { let x = obj () { } - obj () { }; }

View File

@ -1,10 +0,0 @@
// error-pattern: unresolved name: base
type base =
obj {
fn foo();
};
obj derived() {
fn foo() { }
fn bar() { }
}
fn main() { let d: derived = derived(); let b: base = base(d); }

View File

@ -1,7 +0,0 @@
// error-pattern: attempted access of field hello
obj x() {
fn hello() { #debug("hello"); }
}
fn main() { x.hello(); }

View File

@ -1,13 +0,0 @@
//error-pattern:x does not have object type
use std;
fn main() {
let x = 3;
let anon_obj =
obj () {
fn foo() -> int { ret 3; }
with
x
};
}

View File

@ -1,6 +0,0 @@
// error-pattern: unresolved name
obj oT() {
fn get() -> int { ret 3; }
fn foo() { let c = get(); }
}
fn main() { }

View File

@ -1,13 +0,0 @@
// -*- rust -*-
// error-pattern: expected the constraint name
obj f() {
fn g(q: int) -> bool { ret true; }
}
fn main() {
let z = f();
// should fail to typecheck, as z.g isn't an explicit name
check (z.g(42));
}

View File

@ -3,6 +3,6 @@
fn f(a: int, b: int) : lt(a, b) { }
obj lt(a: int, b: int) { }
fn lt(a: int, b: int) { }
fn main() { let a: int = 10; let b: int = 23; check (lt(a, b)); f(a, b); }

View File

@ -1,10 +0,0 @@
// error-pattern:unresolved name: self
// Fix for issue #707.
fn main() {
fn foo() -> int { ret 3(); }
self.foo();
}

View File

@ -1,12 +0,0 @@
// error-pattern:attempted access of field m on type fn
fn main() {
obj foo() {
fn m() {
self();
}
}
let a = foo;
a.m();
}

View File

@ -1,5 +0,0 @@
// error-pattern:assigning to immutable object field
obj objy(x: int) {
fn foo() { x = 5; }
}
fn main() { }

View File

@ -1,14 +0,0 @@
// pp-exact
fn main() {
let my_obj =
obj () {
fn foo() { }
};
let my_ext_obj =
obj () {
fn foo() { }
with
my_obj
};
}

View File

@ -1,25 +0,0 @@
use std;
fn main() {
obj a() {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
}
let my_a = a();
let my_b =
obj () {
fn baz() -> int { ret self.foo(); }
with
my_a
};
assert (my_a.foo() == 2);
assert (my_a.bar() == 2);
assert (my_b.foo() == 2);
assert (my_b.baz() == 2);
assert (my_b.bar() == 2);
}

View File

@ -1,23 +0,0 @@
use std;
fn main() {
obj inner() {
fn a() -> int { ret 2; }
fn m() -> uint { ret 3u; }
fn z() -> uint { ret self.m(); }
}
let my_inner = inner();
let my_outer =
obj () {
fn b() -> uint { ret 5u; }
fn n() -> str { ret "world!"; }
with
my_inner
};
assert (my_inner.z() == 3u);
assert (my_outer.z() == 3u);
}

View File

@ -1,46 +0,0 @@
fn main() {
// The Internet made me do it.
obj cat() {
fn ack() -> str { ret "ack"; }
fn meow() -> str { ret "meow"; }
fn zzz() -> str { ret self.meow(); }
}
let shortcat = cat();
let longcat =
obj () {
fn lol() -> str { ret "lol"; }
fn nyan() -> str { ret "nyan"; }
with
shortcat
};
let longercat =
obj () {
fn meow() -> str { ret "zzz"; }
with
shortcat
};
let evenlongercat =
obj () {
fn meow() -> str { ret "zzzzzz"; }
with
longercat
};
// Tests self-call.
assert (shortcat.zzz() == "meow");
// Tests forwarding/backwarding + self-call.
assert (longcat.zzz() == "meow");
// Tests forwarding/backwarding + self-call + override.
assert (longercat.zzz() == "zzz");
// Tests two-level forwarding/backwarding + self-call + override.
assert (evenlongercat.zzz() == "zzzzzz");
}

View File

@ -1,20 +0,0 @@
use std;
fn main() {
obj a() {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
}
let my_a = a();
// Degenerate anonymous object: one that doesn't add any new
// methods or fields.
let my_d = obj () { with my_a };
assert (my_d.foo() == 2);
assert (my_d.bar() == 2);
}

View File

@ -1,43 +0,0 @@
use std;
fn main() {
// Anonymous object that doesn't extend an existing one.
let my_obj =
obj () {
fn foo() -> int { ret 2; }
fn bar() -> int { ret 3; }
fn baz() -> str { "hello!" }
};
assert (my_obj.foo() == 2);
assert (my_obj.bar() == 3);
assert (my_obj.baz() == "hello!");
// Make sure the result is extendable.
let my_ext_obj =
obj () {
fn foo() -> int { ret 3; }
fn quux() -> str { ret self.baz(); }
with
my_obj
};
assert (my_ext_obj.foo() == 3);
assert (my_ext_obj.bar() == 3);
assert (my_ext_obj.baz() == "hello!");
assert (my_ext_obj.quux() == "hello!");
// And again.
let my_ext_ext_obj =
obj () {
fn baz() -> str { "world!" }
with
my_ext_obj
};
assert (my_ext_ext_obj.foo() == 3);
assert (my_ext_ext_obj.bar() == 3);
assert (my_ext_ext_obj.baz() == "world!");
assert (my_ext_ext_obj.quux() == "world!");
}

View File

@ -1,20 +0,0 @@
//xfail-test
use std;
// This is failing not because it's an anonymous object from nothing
// -- that park seems to work fine -- but, rather, because methods
// that are added to an object at the same time can't refer to each
// other (issue #822).
fn main() {
// Anonymous object that doesn't extend an existing one.
let my_obj = obj () {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
};
assert (my_obj.foo() == 2);
assert (my_obj.bar() == 2);
}

View File

@ -1,18 +0,0 @@
// Reduced test case for issue #543.
fn main() {
obj a() {
fn foo() -> int { ret 2; }
}
let my_a = a();
let my_b =
obj () {
fn foo() -> int { ret 3; }
with
my_a
};
assert (my_b.foo() == 3);
}

View File

@ -1,39 +0,0 @@
use std;
fn main() {
obj a() {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
}
let my_a = a();
// An anonymous object that overloads the 'foo' method.
let my_b =
obj () {
fn foo() -> int { ret 3; }
with
my_a
};
assert (my_b.foo() == 3);
assert (my_b.bar() == 3);
let my_c =
obj () {
fn baz(x: int, y: int) -> int { ret x + y + self.foo(); }
with
my_b
};
let my_d =
obj () {
fn baz(x: int, y: int) -> int { ret x + y + self.foo(); }
with
my_a
};
assert (my_c.baz(1, 2) == 6);
assert (my_d.baz(1, 2) == 5);
}

View File

@ -1,22 +0,0 @@
//xfail-test
// Test case for issue #822.
fn main() {
obj a() {
fn foo() -> int {
ret 2;
}
}
let my_a = a();
let my_b = obj() {
fn bar() -> int {
ret self.baz();
}
fn baz() -> int {
ret 3;
}
with my_a
};
}

View File

@ -1,16 +0,0 @@
// Reduced test case for issue #540.
fn main() {
obj a() {
fn foo() -> int { ret 2; }
}
let my_a = a();
let my_b =
obj () {
fn baz() -> int { ret self.foo(); }
with
my_a
};
assert (my_b.baz() == 2);
}

View File

@ -1,31 +0,0 @@
use std;
fn main() {
obj a() {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
}
let my_a = a();
let my_b =
obj () {
fn baz() -> int { ret self.foo(); }
with
my_a
};
assert (my_b.baz() == 2);
let my_c =
obj () {
fn foo() -> int { ret 3; }
fn baz() -> int { ret self.foo(); }
with
my_a
};
assert (my_c.baz() == 3);
assert (my_c.bar() == 3);
}

View File

@ -1,26 +0,0 @@
//xfail-test
use std;
fn main() {
obj a() {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
}
let my_a = a();
// Extending an object with a new field. Adding support for this
// is issue #538.
// Right now, this fails with "unresolved name: quux".
let my_c =
obj (quux: int = 3) {
fn baz() -> int { ret quux + 4; }
with
my_a
};
assert (my_c.baz() == 7);
}

View File

@ -1,11 +0,0 @@
// -*- rust -*-
obj clam() {
fn chowder() { #debug("in clam chowder"); }
}
fn foo(c: @clam) { c.chowder(); }
fn main() { let c: clam = clam(); foo(@c); }

View File

@ -1,17 +0,0 @@
fn main() {
// Testcase for issue #59.
obj simple(x: int, y: int) {
fn sum() -> int { ret x + y; }
}
let obj0 = simple(1, 2);
let ctor0 = bind simple(1, _);
let ctor1 = bind simple(_, 2);
let obj1 = ctor0(2);
let obj2 = ctor1(1);
assert (obj0.sum() == 3);
assert (obj1.sum() == 3);
assert (obj2.sum() == 3);
}

View File

@ -132,29 +132,6 @@ fn test_native_fn() {
*/
}
fn test_obj() {
let o1 = obj () { };
let o2 = obj () { };
assert (o1 == o1);
// FIXME (#815): This doesn't work on linux only. Wierd.
//assert (o1 != o2);
//assert (!(o1 == o2));
obj constr1(i: int) { }
obj constr2(i: int) { }
let o5 = constr1(10);
let o6 = constr1(10);
let o7 = constr1(11);
let o8 = constr2(11);
assert (o5 != o6);
assert (o6 != o7);
assert (o7 != o8);
}
fn main() {
test_nil();
test_bool();
@ -166,5 +143,4 @@ fn main() {
test_task();
test_fn();
test_native_fn();
test_obj();
}

View File

@ -24,13 +24,6 @@ tag tg { foo; }
tag tg { bar; }
#[cfg(bogus)]
obj o() {
fn f() { ret bogus; }
}
obj o() { }
#[cfg(bogus)]
resource r(i: int) { }

View File

@ -1,10 +1,9 @@
type foo = { mutable z : fn@() };
fn nop() { }
fn nop_foo(_y: o, _x : @foo) { }
fn nop_foo(_y: @int, _x : @foo) { }
obj o() {
}
fn o() -> @int { @10 }
fn main() {
let w = @{ mutable z: bind nop() };

View File

@ -1,9 +0,0 @@
// xfail-test
// Test case for issue #758.
obj foo() { fn f() { } }
fn main() {
let my_foo = foo();
let f = my_foo.f;
}

View File

@ -1,8 +0,0 @@
obj ob<K: copy>(k: K) {
fn foo(it: block(~{a: K})) { it(~{a: k}); }
}
fn x(o: ob<str>) { o.foo() {|_i|}; }
fn main() { let o = ob::<str>("hi" + "there"); x(o); }

View File

@ -1,18 +0,0 @@
obj handle<T: copy>(data: T) {
fn get() -> T { ret data; }
}
fn main() {
type rgb = {x: u8, y: u8, z: u8};
let h: handle<rgb> = handle::<rgb>({x: 1 as u8, y: 2 as u8, z: 3 as u8});
#debug("constructed object");
log(debug, h.get().x);
log(debug, h.get().y);
log(debug, h.get().z);
assert (h.get().x == 1 as u8);
assert (h.get().y == 2 as u8);
assert (h.get().z == 3 as u8);
}

View File

@ -1,23 +0,0 @@
obj buf<T: copy>(data: {_0: T, _1: T, _2: T}) {
fn get(i: int) -> T {
if i == 0 {
ret data._0;
} else { if i == 1 { ret data._1; } else { ret data._2; } }
}
fn take(t: T) { }
fn take2(t: T) { }
}
fn main() {
let b: buf<int> = buf::<int>({_0: 1, _1: 2, _2: 3});
#debug("constructed object");
log(debug, b.get(0));
log(debug, b.get(1));
log(debug, b.get(2));
assert (b.get(0) == 1);
assert (b.get(1) == 2);
assert (b.get(2) == 3);
b.take2(0);
}

View File

@ -59,14 +59,6 @@ fn test_box_rec() {
assert *i == 1;
}
fn test_obj() {
obj o(_f: r) {}
let i = @mutable 0;
let rr = r(i);
{ let _oo = o(rr); }
assert *i == 1;
}
fn main() {
test_box();
test_rec();
@ -75,5 +67,4 @@ fn main() {
test_tup();
test_unique();
test_box_rec();
test_obj();
}

View File

@ -1,17 +0,0 @@
//xfail-test
// Test case for issue #115.
type base =
obj {
fn foo();
};
obj derived() {
fn foo() {}
fn bar() {}
}
fn main() {
let d = derived();
let b:base = d as base;
}

View File

@ -1,22 +0,0 @@
fn main() {
obj a() {
fn foo() -> int { ret 2; }
}
let my_a = a();
let my_b = obj () { with my_a };
assert (my_b.foo() == 2);
let my_c = obj () { with my_b };
assert (my_c.foo() == 2);
// ...One more for good measure.
let my_d = obj () { with my_b };
assert (my_d.foo() == 2);
}

View File

@ -31,13 +31,6 @@ mod test_single_attr_outer {
#[attr = "val"]
#[abi = "cdecl"]
native mod rustrt { }
#[attr = "val"]
type t = obj { };
#[attr = "val"]
obj o() { }
}
mod test_multi_attr_outer {
@ -61,12 +54,7 @@ mod test_multi_attr_outer {
#[attr1 = "val"]
#[attr2 = "val"]
type t = obj { };
#[attr1 = "val"]
#[attr2 = "val"]
obj o() { }
type t = {x: int};
}
mod test_stmt_single_attr_outer {
@ -89,13 +77,6 @@ mod test_stmt_single_attr_outer {
native mod rustrt {
}
*/
#[attr = "val"]
type t = obj { };
#[attr = "val"]
obj o() { }
}
}
@ -123,15 +104,6 @@ mod test_stmt_multi_attr_outer {
native mod rustrt {
}
*/
#[attr1 = "val"]
#[attr2 = "val"]
type t = obj { };
#[attr1 = "val"]
#[attr2 = "val"]
obj o() { }
}
}

View File

@ -1,28 +0,0 @@
fn main() {
obj foo() {
fn m1() -> str { ret "foo.m1"; }
fn m2() -> str { ret self.m1(); }
fn m3() -> str {
let s1: str = self.m2();
assert (s1 == "foo.m1");
obj bar() {
fn m1() -> str { ret "bar.m1"; }
fn m2() -> str { ret self.m1(); }
}
let b = bar();
let s3: str = b.m2();
let s4: str = self.m2();
assert (s4 == "foo.m1");
ret s3;
}
}
let a = foo();
let s1: str = a.m1();
assert (s1 == "foo.m1");
let s2: str = a.m2();
assert (s2 == "foo.m1");
let s3: str = a.m3();
assert (s3 == "bar.m1");
}

View File

@ -1,20 +0,0 @@
// xfail-test
obj big() {
fn one() -> int { ret 1; }
fn two() -> int { ret 2; }
fn three() -> int { ret 3; }
}
type small =
obj {
fn one() -> int ;
};
fn main() {
let b: big = big();
assert (b.one() == 1);
assert (b.two() == 2);
assert (b.three() == 3);
let s: small = b as small;
assert (s.one() == 1);
}

View File

@ -1,57 +0,0 @@
// Sanity-check the code examples that appear in the object system
// documentation.
use std;
import comm::chan;
import comm::send;
import comm::port;
fn main() {
// Ref.Item.Obj
obj counter(state: @mutable int) {
fn incr() { *state += 1; }
fn get() -> int { ret *state; }
}
let c: counter = counter(@mutable 1);
c.incr();
c.incr();
assert (c.get() == 3);
obj my_obj() {
fn get() -> int { ret 3; }
fn foo() -> int {
let c = self.get();
ret c + 2; // returns 5
}
}
let o = my_obj();
assert (o.foo() == 5);
// Ref.Type.Obj
type taker =
obj {
fn take(int);
};
obj adder(x: @mutable int) {
fn take(y: int) { *x += y; }
}
obj sender(c: chan<int>) {
fn take(z: int) { send(c, copy z); }
}
fn give_ints(t: taker) { t.take(1); t.take(2); t.take(3); }
let p = port();
let t1: taker = adder(@mutable 0);
let t2: taker = sender(chan(p));
give_ints(t1);
give_ints(t2);
}

View File

@ -1,8 +0,0 @@
fn main() {
obj handle(i: @int) { }
// This just tests whether the obj leaks its box state members.
let ob = handle(@0xf00f00);
}

View File

@ -1,19 +0,0 @@
type adder =
obj {
fn add();
};
obj leaf_adder(x: int) {
fn add() { #debug("leaf"); log(debug, x); }
}
obj delegate_adder(a: adder) {
fn add() { a.add(); }
}
fn main() {
let x = delegate_adder(delegate_adder(delegate_adder(leaf_adder(10))));
x.add();
}

View File

@ -1,13 +0,0 @@
// -*- rust -*-
tag clam<T> { signed(int); unsigned(uint); }
fn getclam<T>() -> clam<T> { ret signed::<T>(42); }
obj impatience<T: copy>() {
fn moreclam() -> clam<T> { be getclam::<T>(); }
}
fn main() { }

View File

@ -1,12 +0,0 @@
fn main() {
obj foo() {
fn m1(i: int) { let i = i + 1; #debug("hi!"); }
fn m2(i: int) { let i = i + 1; self.m1(i); }
}
let a = foo();
let i: int = 0;
a.m1(i);
a.m2(i);
}

View File

@ -1,17 +0,0 @@
fn main() {
obj foo() {
fn m1(i: int) -> int { let i = i + 1; ret i; }
fn m2(i: int) -> int { ret self.m1(i); }
fn m3(i: int) -> int { let i = i + 1; ret self.m1(i); }
}
let a = foo();
let i: int = 0;
i = a.m1(i);
assert (i == 1);
i = a.m2(i);
assert (i == 2);
i = a.m3(i);
assert (i == 4);
}

View File

@ -1,22 +0,0 @@
fn main() {
obj foo(mutable i: int) {
fn inc_by(incr: int) -> int { i += incr; ret i; }
fn inc_by_5() -> int { ret self.inc_by(5); }
// A test case showing that issue #324 is resolved. (It used to
// be that commenting out this (unused!) function produced a
// type error.)
// fn wrapper(int incr) -> int {
// ret self.inc_by(incr);
// }
fn get() -> int { ret i; }
}
let rs: int;
let o = foo(5);
rs = o.get();
assert (rs == 5);
rs = o.inc_by(3);
assert (rs == 8);
rs = o.get();
assert (rs == 8);
}

View File

@ -1,11 +0,0 @@
fn main() {
obj foo() {
fn m1() { #debug("hi!"); }
fn m2() { self.m1(); }
}
let a = foo();
a.m1();
a.m2();
}

View File

@ -1,10 +0,0 @@
fn main() {
obj buf(data: [u8]) {
fn get(i: int) -> u8 { ret data[i]; }
}
let b = buf([1 as u8, 2 as u8, 3 as u8]);
log(debug, b.get(1));
assert (b.get(1) == 2 as u8);
}

View File

@ -1,29 +0,0 @@
use std;
fn main() {
obj normal() {
fn foo() -> int { ret 2; }
}
let my_normal_obj = normal();
// Extending an object with a new method
let my_anon_obj =
obj () {
fn bar() -> int { ret 3; }
with
my_normal_obj
};
assert (my_normal_obj.foo() == 2);
assert (my_anon_obj.bar() == 3);
let another_anon_obj =
obj () {
fn baz() -> int { ret 4; }
with
my_anon_obj
};
assert (another_anon_obj.baz() == 4);
}

View File

@ -1,9 +0,0 @@
// -*- rust -*-
obj x() {
fn hello() { #debug("hello, object world"); }
}
fn main() { let mx = x(); mx.hello(); }

View File

@ -1,20 +0,0 @@
// xfail-test
// Test case for issue #435.
obj foo(x: int) {
fn add5(n: int) -> int { ret n + x; }
}
fn add5(n: int) -> int { ret n + 5; }
fn main() {
let fiveplusseven = bind add5(7);
assert (add5(7) == 12);
assert (fiveplusseven() == 12);
let my_foo = foo(5);
let fiveplusseven_too = bind my_foo.add5(7);
assert (my_foo.add5(7) == 12);
assert (fiveplusseven_too() == 12);
}

View File

@ -1,19 +0,0 @@
// -*- rust -*-
obj counter(mutable x: int) {
fn hello() -> int { ret 12345; }
fn incr() { x = x + 1; }
fn get() -> int { ret x; }
}
fn main() {
let y = counter(0);
assert (y.hello() == 12345);
log(debug, y.get());
y.incr();
y.incr();
log(debug, y.get());
assert (y.get() == 2);
}

View File

@ -1,9 +0,0 @@
tag colour { red; green; }
obj foo<T>() {
fn meth(x: T) { }
}
fn main() { foo::<colour>().meth(red); }

View File

@ -12,7 +12,6 @@ fn main() {
test00();
// test01();
test02();
test03();
test04();
test05();
test06();
@ -78,18 +77,6 @@ fn test02() {
log(debug, value);
}
obj vector(mutable x: int, y: int) {
fn length() -> int { x = x + 2; ret x + y; }
}
fn test03() {
#debug("Creating object ...");
let v: vector = vector(1, 2);
#debug("created object ...");
let t: vector = v;
log(debug, v.length());
}
fn test04_start() {
#debug("Started task");
let i: int = 1024 * 1024;