Comments for all the anon obj tests.

This commit is contained in:
Lindsey Kuper 2011-06-21 16:32:27 -07:00
parent 7fb35ecf84
commit efd8ff4647
4 changed files with 14 additions and 1 deletions

View file

@ -19,8 +19,10 @@ fn main() {
// methods or fields. Adding support for this is issue #539.
// (Making this work will also ensure that calls to anonymous
// objects "fall through" appropriately.)
auto my_d = obj() { with my_a };
// Right now, this fails with "unknown method 'foo' of obj".
assert (my_d.foo() == 2);
assert (my_d.bar() == 2);

View file

@ -30,5 +30,11 @@ fn main() {
// The tricky part -- have to be sure to tie the knot in the right
// place, so that bar() knows about the new foo().
// Right now, this just fails with "unknown method 'bar' of obj",
// but that's the easier of our worries; that'll be fixed when
// issue #539 is fixed. The bigger problem will be when we do
// 'fall through' to bar() on the original object -- then we have
// to be sure that self refers to the extended object.
assert (my_b.bar() == 3);
}

View file

@ -17,6 +17,9 @@ fn main() {
// Extending an object with a new method that contains a simple
// self-call. Adding support for this is issue #540.
// Right now, this fails with a failed lookup in a hashmap; not
// sure where, but I think it might be during typeck.
auto my_b = obj {
fn baz() -> int {
ret self.foo();
@ -24,6 +27,6 @@ fn main() {
with my_a
};
assert (my_b.baz() == 2);
assert my_b.baz() == 2);
}

View file

@ -17,6 +17,8 @@ fn main() {
// Extending an object with a new field. Adding support for this
// is issue #538.
// Right now, this fails with "unresolved name: quux".
auto my_c = obj(int quux = 3) {
fn baz() -> int {
ret quux + 4;