Skip to content

Commit f1db420

Browse files
committed
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 rust-lang#114.
1 parent bacb8e6 commit f1db420

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/boot/me/semant.ml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1758,11 +1758,7 @@ and lookup_by_ident
17581758
check_slots scopes f.Ast.fn_input_slots
17591759

17601760
| Ast.MOD_ITEM_obj obj ->
1761-
begin
1762-
match htab_search obj.Ast.obj_fns ident with
1763-
Some fn -> found cx scopes fn.id
1764-
| None -> check_slots scopes obj.Ast.obj_state
1765-
end
1761+
check_slots scopes obj.Ast.obj_state
17661762

17671763
| Ast.MOD_ITEM_mod md ->
17681764
project_ident_from_items cx lchk
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// error-pattern: unresolved identifier
2+
obj oT() {
3+
fn get() -> int {
4+
ret 3;
5+
}
6+
fn foo() {
7+
auto c = get();
8+
}
9+
}
10+
fn main() {
11+
}

0 commit comments

Comments
 (0)