Some cleanup in check_expr.

This commit is contained in:
Michael Sullivan
2011-08-10 18:25:27 -07:00
parent d2c1fbd218
commit 00b781e495

View File

@@ -1582,15 +1582,14 @@ fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) -> bool {
} }
// Check the arguments. // Check the arguments.
// TODO: iter2
let i = 0u; let i = 0u;
for a_opt: option::t[@ast::expr] in args { for a_opt: option::t[@ast::expr] in args {
alt a_opt { alt a_opt {
some(a) { some(a) {
bot |= check_expr(fcx, a); bot |= check_expr(fcx, a);
demand::full(fcx, a.span, arg_tys.(i).ty, demand::autoderef(fcx, a.span, arg_tys.(i).ty,
expr_ty(fcx.ccx.tcx, a), ~[], expr_ty(fcx.ccx.tcx, a),
AUTODEREF_BLOCK_COERCE); AUTODEREF_BLOCK_COERCE);
} }
none. { } none. { }
} }
@@ -1836,16 +1835,16 @@ fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) -> bool {
if ty::def_has_ty_params(defn) { if ty::def_has_ty_params(defn) {
let path_tpot = instantiate_path(fcx, pth, tpt, expr.span); let path_tpot = instantiate_path(fcx, pth, tpt, expr.span);
write::ty_fixup(fcx, id, path_tpot); write::ty_fixup(fcx, id, path_tpot);
ret false; } else {
// The definition doesn't take type parameters. If the programmer
// supplied some, that's an error.
if ivec::len[@ast::ty](pth.node.types) > 0u {
tcx.sess.span_fatal(expr.span,
"this kind of value does not \
take type parameters");
}
write::ty_only_fixup(fcx, id, tpt.ty);
} }
// The definition doesn't take type parameters. If the programmer
// supplied some, that's an error.
if ivec::len[@ast::ty](pth.node.types) > 0u {
tcx.sess.span_fatal(expr.span,
"this kind of value does not \
take type parameters");
}
write::ty_only_fixup(fcx, id, tpt.ty);
} }
ast::expr_mac(_) { tcx.sess.bug("unexpanded macro"); } ast::expr_mac(_) { tcx.sess.bug("unexpanded macro"); }
ast::expr_fail(expr_opt) { ast::expr_fail(expr_opt) {
@@ -2493,7 +2492,6 @@ fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) -> bool {
for method: @ast::method in ao.methods { for method: @ast::method in ao.methods {
check_method(fcx.ccx, method); check_method(fcx.ccx, method);
} }
next_ty_var(fcx);
// Now remove the info from the stack. // Now remove the info from the stack.
ivec::pop[obj_info](fcx.ccx.obj_infos); ivec::pop[obj_info](fcx.ccx.obj_infos);