aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2010-12-16 13:59:20 -0800
committerPatrick Walton <[email protected]>2010-12-16 13:59:20 -0800
commita6c6e8679e2a04624be710c00828bd59d1f4cc3b (patch)
treece73e242c25ce77c3f8bceae0bcee3cf8ae0cfe7
parentrustc: Write types back when typechecking "ret" statements (diff)
downloadrust-a6c6e8679e2a04624be710c00828bd59d1f4cc3b.tar.xz
rust-a6c6e8679e2a04624be710c00828bd59d1f4cc3b.zip
rustc: Only generalize on definition types that can actually be parametric
-rw-r--r--src/comp/middle/typeck.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 2529ab29..b5362263 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -1767,7 +1767,7 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
}
case (ast.def_fn(?id)) {
check (fcx.ccx.item_types.contains_key(id));
- t = fcx.ccx.item_types.get(id);
+ t = generalize_ty(fcx.ccx, fcx.ccx.item_types.get(id));
}
case (ast.def_const(?id)) {
check (fcx.ccx.item_types.contains_key(id));
@@ -1783,7 +1783,7 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
}
case (ast.def_obj(?id)) {
check (fcx.ccx.item_types.contains_key(id));
- t = fcx.ccx.item_types.get(id);
+ t = generalize_ty(fcx.ccx, fcx.ccx.item_types.get(id));
}
case (_) {
@@ -1794,8 +1794,6 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
}
}
- t = generalize_ty(fcx.ccx, t);
-
ret @fold.respan[ast.expr_](expr.span,
ast.expr_name(name, defopt,
ast.ann_type(t)));