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:
Tim Chevalier
2012-06-15 14:55:03 -07:00
parent 7a253eabce
commit 093faaabe1
4 changed files with 5 additions and 5 deletions

View File

@@ -455,7 +455,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
visit_expr: fn@(e: @expr) {
vfn(e.id);
alt e.node {
expr_unary(_, _) | expr_binary(_, _, _) {
expr_unary(*) | expr_binary(*) | expr_index(*) {
vfn(ast_util::op_expr_callee_id(e));
}
_ { /* fallthrough */ }

View File

@@ -200,7 +200,7 @@ fn visit_ids(item: ast::inlined_item, vfn: fn@(ast::node_id)) {
visit_expr: fn@(e: @ast::expr) {
vfn(e.id);
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));
}
_ { /* fallthrough */ }

View File

@@ -583,7 +583,7 @@ fn check_loans_in_expr(expr: @ast::expr,
expr.span,
[rval]);
}
ast::expr_unary(_, _)
ast::expr_unary(*) | ast::expr_index(*)
if self.bccx.method_map.contains_key(expr.id) {
self.check_call(expr,
none,

View File

@@ -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);
}
ast::expr_binary(_, _, _) | ast::expr_unary(_, _) |
ast::expr_assign_op(_, _, _) | ast::expr_index(_, _) {
ast::expr_binary(*) | ast::expr_unary(*) | ast::expr_assign_op(*)
| ast::expr_index(*) {
maybe_resolve_type_vars_for_node(wbcx, e.span,
ast_util::op_expr_callee_id(e));
}