Skip to content

Commit 55a213b

Browse files
committed
---
yaml --- r: 3983 b: refs/heads/master c: b6fc86a h: refs/heads/master i: 3981: 29a9ef0 3979: 3c065b8 3975: a6e94f9 3967: a59c27b v: v3
1 parent 2a78109 commit 55a213b

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 46b0aa5c5cf92804219766e3254fc89a3fc583b0
2+
refs/heads/master: b6fc86ae5ac9586bc2989ee0351895873abb9101

trunk/src/comp/middle/typeck.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
20922092
}
20932093
case (ast::expr_self_method(?ident)) {
20942094
auto t = ty::mk_nil(fcx.ccx.tcx);
2095-
let ty::t this_obj_ty;
2095+
let ty::t this_obj_ty = ty::mk_nil(fcx.ccx.tcx);
20962096
let option::t[obj_info] this_obj_info = get_obj_info(fcx.ccx);
20972097
alt (this_obj_info) {
20982098
case (
@@ -2106,7 +2106,12 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
21062106
ty::lookup_item_type(fcx.ccx.tcx,
21072107
local_def(obj_info.this_obj))._1;
21082108
}
2109-
case (none) { fail; }
2109+
case (none) {
2110+
// Shouldn't happen.
2111+
fcx.ccx.tcx.sess.span_err(expr.span,
2112+
"self-call in non-object \
2113+
context");
2114+
}
21102115
}
21112116
// Grab this method's type out of the current object type.
21122117

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//xfail-stage0
2+
3+
// error-pattern:self-call in non-object context
4+
5+
// Fix for issue #707.
6+
fn main() {
7+
8+
fn foo() -> int {
9+
ret 3();
10+
}
11+
12+
self.foo();
13+
14+
}

0 commit comments

Comments
 (0)