Handle index expressions' callee IDs correctly
Some code that handles unary and binary exprs' callee IDs was
forgetting to handle the index expr case (since calls to
user-defined index operators also have callee IDs). This was
manifesting as an ICE in trans because when monomorphizing a
function that had one of these operators in it (an index into a
dvec, in the test case), the callee ID would be unbound to a type.
Fixed it. Closes #2631.
This commit is contained in:
@@ -455,7 +455,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
|
|||||||
visit_expr: fn@(e: @expr) {
|
visit_expr: fn@(e: @expr) {
|
||||||
vfn(e.id);
|
vfn(e.id);
|
||||||
alt e.node {
|
alt e.node {
|
||||||
expr_unary(_, _) | expr_binary(_, _, _) {
|
expr_unary(*) | expr_binary(*) | expr_index(*) {
|
||||||
vfn(ast_util::op_expr_callee_id(e));
|
vfn(ast_util::op_expr_callee_id(e));
|
||||||
}
|
}
|
||||||
_ { /* fallthrough */ }
|
_ { /* fallthrough */ }
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ fn visit_ids(item: ast::inlined_item, vfn: fn@(ast::node_id)) {
|
|||||||
visit_expr: fn@(e: @ast::expr) {
|
visit_expr: fn@(e: @ast::expr) {
|
||||||
vfn(e.id);
|
vfn(e.id);
|
||||||
alt e.node {
|
alt e.node {
|
||||||
ast::expr_unary(_, _) | ast::expr_binary(_, _, _) {
|
ast::expr_unary(*) | ast::expr_binary(*) | ast::expr_index(*) {
|
||||||
vfn(ast_util::op_expr_callee_id(e));
|
vfn(ast_util::op_expr_callee_id(e));
|
||||||
}
|
}
|
||||||
_ { /* fallthrough */ }
|
_ { /* fallthrough */ }
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
|||||||
expr.span,
|
expr.span,
|
||||||
[rval]);
|
[rval]);
|
||||||
}
|
}
|
||||||
ast::expr_unary(_, _)
|
ast::expr_unary(*) | ast::expr_index(*)
|
||||||
if self.bccx.method_map.contains_key(expr.id) {
|
if self.bccx.method_map.contains_key(expr.id) {
|
||||||
self.check_call(expr,
|
self.check_call(expr,
|
||||||
none,
|
none,
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ fn visit_expr(e: @ast::expr, wbcx: wb_ctxt, v: wb_vt) {
|
|||||||
resolve_type_vars_for_node(wbcx, e.span, alloc_id);
|
resolve_type_vars_for_node(wbcx, e.span, alloc_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::expr_binary(_, _, _) | ast::expr_unary(_, _) |
|
ast::expr_binary(*) | ast::expr_unary(*) | ast::expr_assign_op(*)
|
||||||
ast::expr_assign_op(_, _, _) | ast::expr_index(_, _) {
|
| ast::expr_index(*) {
|
||||||
maybe_resolve_type_vars_for_node(wbcx, e.span,
|
maybe_resolve_type_vars_for_node(wbcx, e.span,
|
||||||
ast_util::op_expr_callee_id(e));
|
ast_util::op_expr_callee_id(e));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user