aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-07-19 12:03:58 -0700
committerGraydon Hoare <[email protected]>2010-07-19 12:03:58 -0700
commitf1db420317a53eacf3dfb08b8121ea06ad1ca5b5 (patch)
tree401a0a20769491e13f125a81f282ed5962ddb4cf
parentMissing semicolon in type.ml, plus test to catch regression. Closes #113. (diff)
downloadrust-f1db420317a53eacf3dfb08b8121ea06ad1ca5b5.tar.xz
rust-f1db420317a53eacf3dfb08b8121ea06ad1ca5b5.zip
Fix over-optimistic resolution of self-methods within obj scopes. There is no such feature in the language at present. Add test to prevent regression. Closes #114.
-rw-r--r--src/boot/me/semant.ml6
-rw-r--r--src/test/compile-fail/no-self-dispatch.rs11
2 files changed, 12 insertions, 5 deletions
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml
index 789a2360..1992bf93 100644
--- a/src/boot/me/semant.ml
+++ b/src/boot/me/semant.ml
@@ -1758,11 +1758,7 @@ and lookup_by_ident
check_slots scopes f.Ast.fn_input_slots
| Ast.MOD_ITEM_obj obj ->
- begin
- match htab_search obj.Ast.obj_fns ident with
- Some fn -> found cx scopes fn.id
- | None -> check_slots scopes obj.Ast.obj_state
- end
+ check_slots scopes obj.Ast.obj_state
| Ast.MOD_ITEM_mod md ->
project_ident_from_items cx lchk
diff --git a/src/test/compile-fail/no-self-dispatch.rs b/src/test/compile-fail/no-self-dispatch.rs
new file mode 100644
index 00000000..be90c12f
--- /dev/null
+++ b/src/test/compile-fail/no-self-dispatch.rs
@@ -0,0 +1,11 @@
+// error-pattern: unresolved identifier
+obj oT() {
+ fn get() -> int {
+ ret 3;
+ }
+ fn foo() {
+ auto c = get();
+ }
+}
+fn main() {
+}