report the type of the method as the fty, not the type of the expression

using the type of the expression causes us to lose information
about when the method was declaring with a generic signature, which
leads to producing incorrect code, particularly in the case of returning
unit types (which would then get an undefined output ptr)
This commit is contained in:
Niko Matsakis 2012-02-29 11:35:44 -08:00
parent 7d0958f70f
commit ed952ecf68
1 changed files with 3 additions and 2 deletions

View File

@ -121,9 +121,10 @@ fn trans_vtable_callee(bcx: block, env: callee_env, dict: ValueRef,
n_method: uint) -> lval_maybe_callee {
let bcx = bcx, ccx = bcx.ccx(), tcx = ccx.tcx;
let method = ty::iface_methods(tcx, iface_id)[n_method];
let method_ty = ty::mk_fn(tcx, method.fty);
let {ty: fty, llty: llfty} =
wrapper_fn_ty(ccx, val_ty(dict), node_id_type(bcx, callee_id),
method.tps);
wrapper_fn_ty(ccx, val_ty(dict), method_ty, method.tps);
// node_id_type(bcx, callee_id),
let vtable = PointerCast(bcx, Load(bcx, GEPi(bcx, dict, [0, 0])),
T_ptr(T_array(T_ptr(llfty), n_method + 1u)));
let mptr = Load(bcx, GEPi(bcx, vtable, [0, n_method as int]));