about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLindsey Kuper <lkuper@mozilla.com>2011-07-29 18:28:23 -0700
committerLindsey Kuper <lkuper@mozilla.com>2011-07-29 18:30:27 -0700
commit6ba4e349598aa736449a985d38348f083efdfb9d (patch)
tree869d91802b6394a367e7ffe8d7a1c88782dae7c5
parenta34f7c8cb345a0ae702accfe2e4afeeb1545d8f3 (diff)
downloadrust-6ba4e349598aa736449a985d38348f083efdfb9d.tar.gz
rust-6ba4e349598aa736449a985d38348f083efdfb9d.zip
Reduced test case for current backwarding bug.
Still working on getting backwarding to play nicely with self and
overriding.  Currently can't fix issue #702 without breaking how self
and overriding interact.
-rw-r--r--src/test/run-pass/anon-obj-backwarding-2.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/run-pass/anon-obj-backwarding-2.rs b/src/test/run-pass/anon-obj-backwarding-2.rs
new file mode 100644
index 00000000000..a0d6e573229
--- /dev/null
+++ b/src/test/run-pass/anon-obj-backwarding-2.rs
@@ -0,0 +1,35 @@
+//xfail-stage0
+//xfail-stage1
+//xfail-stage2
+//xfail-stage3
+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
+    };
+
+    // These should all be 2.
+    log_err my_a.foo();
+    log_err my_a.bar();
+    log_err my_b.foo();
+
+    // This works fine.  It sends us to foo on my_b, which forwards to
+    // foo on my_a.
+    log_err my_b.baz();
+
+    // Currently segfaults.  It forwards us to bar on my_a, which
+    // backwards us to foo on my_b, which forwards us to foo on my_a
+    // -- or, at least, that's how it should work.
+    log_err my_b.bar();
+
+}