Skip to content

Commit

Permalink
Fix over-optimistic resolution of self-methods within obj scopes. The…
Browse files Browse the repository at this point in the history
…re is no such feature in the language at present. Add test to prevent regression. Closes rust-lang#114.
  • Loading branch information
graydon committed Jul 19, 2010
1 parent bacb8e6 commit f1db420
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/boot/me/semant.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/test/compile-fail/no-self-dispatch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// error-pattern: unresolved identifier
obj oT() {
fn get() -> int {
ret 3;
}
fn foo() {
auto c = get();
}
}
fn main() {
}

0 comments on commit f1db420

Please sign in to comment.