diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-06 10:23:55 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-06 17:40:05 +0100 |
| commit | 7c1f683c6d93cdb5fee8a664cd6b5ff2397e1d04 (patch) | |
| tree | 3b4781492ff8cb0458738f51ec9e601b5dee0d54 /src/comp | |
| parent | 295df68faf1e881d7fda09406f47bb99ef7f4d43 (diff) | |
Fix bug in method type parameter passing
It would occasionally pass the wrong type parameter, when calling a generic method from a generic impl on a bounded param type.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/trans_impl.rs | 3 | ||||
| -rw-r--r-- | src/comp/middle/typeck.rs | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/comp/middle/trans_impl.rs b/src/comp/middle/trans_impl.rs index bddfbb03e6e..6db94fba367 100644 --- a/src/comp/middle/trans_impl.rs +++ b/src/comp/middle/trans_impl.rs @@ -55,7 +55,8 @@ fn trans_dict_callee(bcx: @block_ctxt, e: @ast::expr, base: @ast::expr, let generic = none; if vec::len(*method.tps) > 0u { let tydescs = [], tis = []; - for t in ty::node_id_to_type_params(tcx, e.id) { + let tptys = ty::node_id_to_type_params(tcx, e.id); + for t in vec::tail_n(tptys, vec::len(tptys) - vec::len(*method.tps)) { // TODO: Doesn't always escape. let ti = none; let td = get_tydesc(bcx, t, true, tps_normal, ti).result; diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 7037fa3ff30..d75b04d0787 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -1037,8 +1037,8 @@ mod writeback { }; let new_substs_opt; alt tpot.substs { - none::<[ty::t]>. { new_substs_opt = none::<[ty::t]>; } - some::<[ty::t]>(substs) { + none. { new_substs_opt = none; } + some(substs) { let new_substs: [ty::t] = []; for subst: ty::t in substs { alt resolve_type_vars_in_type(fcx, sp, subst) { @@ -1046,7 +1046,7 @@ mod writeback { none. { wbcx.success = false; ret; } } } - new_substs_opt = some::<[ty::t]>(new_substs); + new_substs_opt = some(new_substs); } } write::ty(fcx.ccx.tcx, id, {substs: new_substs_opt, ty: new_ty}); @@ -1568,7 +1568,6 @@ fn lookup_method(fcx: @fn_ctxt, isc: resolve::iscopes, } bound_n += 1u; } - _ {} } } ret none; |
