From 35e021ed53d3ab9e63686ec7d79bc3ca2af0c820 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 14 Apr 2011 12:33:26 -0700 Subject: rustc: Perform type substitutions when recording locals --- src/comp/middle/typeck.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 4fb685ec..211fb349 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -858,6 +858,15 @@ mod Unify { } } } + + // TODO: "freeze" + let vec[@ty.t] param_substs_1 = vec(); + for (@ty.t subst in param_substs) { + param_substs_1 += vec(subst); + } + + unified_type = + ty.substitute_type_params(param_substs_1, unified_type); fcx.locals.insert(id, unified_type); } fn record_param(uint index, @ty.t binding) -> ty.unify_result { @@ -1617,7 +1626,8 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat { } fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr { - // log "typechecking expr " + pretty.pprust.expr_to_str(expr); + //fcx.ccx.sess.span_warn(expr.span, "typechecking expr " + + // pretty.pprust.expr_to_str(expr)); // A generic function to factor out common logic from call and bind // expressions. -- cgit v1.2.3