about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-03-08 12:42:56 -0800
committerPatrick Walton <pcwalton@mimiga.net>2011-03-08 12:42:56 -0800
commit4654faa67c831728c677027f2beb48fe3592b511 (patch)
tree36352677b4415e077c97dc688583a1ce7f097e79 /src/comp
parente2f6f19fc807e1e9067a5fa6abc188ddf21f775c (diff)
downloadrust-4654faa67c831728c677027f2beb48fe3592b511.tar.gz
rust-4654faa67c831728c677027f2beb48fe3592b511.zip
rustc: Add a slot for explicit type parameter instantations to the typechecker's AST annotation
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/front/ast.rs2
-rw-r--r--src/comp/middle/trans.rs2
-rw-r--r--src/comp/middle/ty.rs2
-rw-r--r--src/comp/middle/typeck.rs197
4 files changed, 122 insertions, 81 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 52ae66c8502..5691480016b 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -21,7 +21,7 @@ type ty_param = rec(ident ident, def_id id);
 // Annotations added during successive passes.
 tag ann {
     ann_none;
-    ann_type(@middle.ty.t);
+    ann_type(@middle.ty.t, option.t[vec[@middle.ty.t]] /* ty param substs */);
 }
 
 tag def {
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index fffa325f34e..7457a5326bd 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -2238,7 +2238,7 @@ fn node_ann_type(@crate_ctxt cx, &ast.ann a) -> @ty.t {
         case (ast.ann_none) {
             cx.sess.bug("missing type annotation");
         }
-        case (ast.ann_type(?t)) {
+        case (ast.ann_type(?t, _)) {
             ret target_type(cx, t);
         }
     }
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index c33b5d8d17d..9ae39c9d420 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -599,7 +599,7 @@ fn ann_to_type(&ast.ann ann) -> @t {
             // shouldn't happen, but can until the typechecker is complete
             ret plain_ty(ty_var(-1));    // FIXME: broken, broken, broken
         }
-        case (ast.ann_type(?ty)) {
+        case (ast.ann_type(?ty, _)) {
             ret ty;
         }
     }
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 9634841a836..cf917d19ef0 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -540,7 +540,10 @@ fn collect_item_types(session.session sess, @ast.crate crate)
 
             item_to_ty.insert(variant.id, result_ty);
 
-            auto variant_t = rec(ann=ast.ann_type(result_ty) with variant);
+            auto variant_t = rec(
+                ann=ast.ann_type(result_ty, none[vec[@ty.t]])
+                with variant
+            );
             result += vec(variant_t);
         }
 
@@ -641,9 +644,9 @@ fn collect_item_types(session.session sess, @ast.crate crate)
                        @ast.ty t, @ast.expr ex,
                        ast.def_id id, ast.ann a) -> @ast.item {
         check (e.item_to_ty.contains_key(id));
-        auto ty = e.item_to_ty.get(id);
+        auto typ = e.item_to_ty.get(id);
         auto item = ast.item_const(i, t, ex, id,
-                                   ast.ann_type(ty));
+                                   ast.ann_type(typ, none[vec[@ty.t]]));
         ret @fold.respan[ast.item_](sp, item);
     }
 
@@ -653,9 +656,9 @@ fn collect_item_types(session.session sess, @ast.crate crate)
         collect_ty_params(e, id, ty_params);
 
         check (e.item_to_ty.contains_key(id));
-        auto ty = e.item_to_ty.get(id);
+        auto typ = e.item_to_ty.get(id);
         auto item = ast.item_fn(i, f, ty_params, id,
-                                ast.ann_type(ty));
+                                ast.ann_type(typ, none[vec[@ty.t]]));
         ret @fold.respan[ast.item_](sp, item);
     }
 
@@ -665,9 +668,9 @@ fn collect_item_types(session.session sess, @ast.crate crate)
         collect_ty_params(e, id, ty_params);
 
         check (e.item_to_ty.contains_key(id));
-        auto ty = e.item_to_ty.get(id);
+        auto typ = e.item_to_ty.get(id);
         auto item = ast.native_item_fn(i, d, ty_params, id,
-                                       ast.ann_type(ty));
+                                       ast.ann_type(typ, none[vec[@ty.t]]));
         ret @fold.respan[ast.native_item_](sp, item);
     }
 
@@ -713,14 +716,20 @@ fn collect_item_types(session.session sess, @ast.crate crate)
             auto meth_tfn = plain_ty(ty.ty_fn(meth_ty.proto,
                                               meth_ty.inputs,
                                               meth_ty.output));
-            m_ = rec(ann=ast.ann_type(meth_tfn) with meth.node);
+            m_ = rec(
+                ann=ast.ann_type(meth_tfn, none[vec[@ty.t]])
+                with meth.node
+            );
             m = @rec(node=m_ with *meth);
             append[@ast.method](methods, m);
         }
         auto g = bind getter(e.id_to_ty_item, e.item_to_ty, _);
         for (ast.obj_field fld in ob.fields) {
             let @ty.t fty = ast_ty_to_ty(g, fld.ty);
-            let ast.obj_field f = rec(ann=ast.ann_type(fty) with fld);
+            let ast.obj_field f = rec(
+                ann=ast.ann_type(fty, none[vec[@ty.t]])
+                with fld
+            );
             append[ast.obj_field](fields, f);
         }
 
@@ -728,7 +737,7 @@ fn collect_item_types(session.session sess, @ast.crate crate)
                        fields = fields
                        with ob);
         auto item = ast.item_obj(i, ob_, ty_params, id,
-                                 ast.ann_type(t));
+                                 ast.ann_type(t, none[vec[@ty.t]]));
         ret @fold.respan[ast.item_](sp, item);
     }
 
@@ -738,9 +747,9 @@ fn collect_item_types(session.session sess, @ast.crate crate)
         collect_ty_params(e, id, ty_params);
 
         check (e.item_to_ty.contains_key(id));
-        auto ty = e.item_to_ty.get(id);
+        auto typ = e.item_to_ty.get(id);
         auto item = ast.item_ty(i, t, ty_params, id,
-                                ast.ann_type(ty));
+                                ast.ann_type(typ, none[vec[@ty.t]]));
         ret @fold.respan[ast.item_](sp, item);
     }
 
@@ -908,16 +917,16 @@ fn demand_pat(&@fn_ctxt fcx, @ty.t expected, @ast.pat pat) -> @ast.pat {
     alt (pat.node) {
         case (ast.pat_wild(?ann)) {
             auto t = demand(fcx, pat.span, expected, ann_to_type(ann));
-            p_1 = ast.pat_wild(ast.ann_type(t));
+            p_1 = ast.pat_wild(ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.pat_lit(?lit, ?ann)) {
             auto t = demand(fcx, pat.span, expected, ann_to_type(ann));
-            p_1 = ast.pat_lit(lit, ast.ann_type(t));
+            p_1 = ast.pat_lit(lit, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.pat_bind(?id, ?did, ?ann)) {
             auto t = demand(fcx, pat.span, expected, ann_to_type(ann));
             fcx.locals.insert(did, t);
-            p_1 = ast.pat_bind(id, did, ast.ann_type(t));
+            p_1 = ast.pat_bind(id, did, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.pat_tag(?id, ?subpats, ?vdef_opt, ?ann)) {
             auto t = demand(fcx, pat.span, expected, ann_to_type(ann));
@@ -939,10 +948,14 @@ fn demand_pat(&@fn_ctxt fcx, @ty.t expected, @ast.pat pat) -> @ast.pat {
             alt (variant_ty.struct) {
                 case (ty.ty_tag(_, _)) {
                     // Nullary tag variant.
+                    // TODO: ty param substs
                     check (subpats_len == 0u);
-                    p_1 = ast.pat_tag(id, subpats, vdef_opt, ast.ann_type(t));
+                    p_1 = ast.pat_tag(id, subpats, vdef_opt,
+                                      ast.ann_type(t, none[vec[@ty.t]]));
                 }
                 case (ty.ty_fn(_, ?args, ?tag_ty)) {
+                    // N-ary tag variant.
+                    // TODO: ty param substs
                     let vec[@ast.pat] new_subpats = vec();
                     auto i = 0u;
                     for (arg a in args) {
@@ -951,7 +964,7 @@ fn demand_pat(&@fn_ctxt fcx, @ty.t expected, @ast.pat pat) -> @ast.pat {
                         i += 1u;
                     }
                     p_1 = ast.pat_tag(id, new_subpats, vdef_opt,
-                                      ast.ann_type(tag_ty));
+                                      ast.ann_type(tag_ty, none[vec[@ty.t]]));
                 }
             }
         }
@@ -990,7 +1003,7 @@ fn demand_expr_full(&@fn_ctxt fcx, @ty.t expected, @ast.expr e,
                     fail;
                 }
             }
-            e_1 = ast.expr_vec(es_1, ast.ann_type(t));
+            e_1 = ast.expr_vec(es_1, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_tup(?es_0, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
@@ -1009,7 +1022,7 @@ fn demand_expr_full(&@fn_ctxt fcx, @ty.t expected, @ast.expr e,
                     fail;
                 }
             }
-            e_1 = ast.expr_tup(elts_1, ast.ann_type(t));
+            e_1 = ast.expr_tup(elts_1, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_rec(?fields_0, ?base_0, ?ann)) {
 
@@ -1062,11 +1075,12 @@ fn demand_expr_full(&@fn_ctxt fcx, @ty.t expected, @ast.expr e,
                     fail;
                 }
             }
-            e_1 = ast.expr_rec(fields_1, base_1, ast.ann_type(t));
+            e_1 = ast.expr_rec(fields_1, base_1,
+                               ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_bind(?sube, ?es, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_bind(sube, es, ast.ann_type(t));
+            e_1 = ast.expr_bind(sube, es, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_call(?sube, ?es, ?ann)) {
             // NB: we call 'demand_full' and pass in adk only in cases where
@@ -1074,25 +1088,28 @@ fn demand_expr_full(&@fn_ctxt fcx, @ty.t expected, @ast.expr e,
             // like expr_binary or expr_bind can't, so there's no need.
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
-            e_1 = ast.expr_call(sube, es, ast.ann_type(t));
+            e_1 = ast.expr_call(sube, es, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_binary(?bop, ?lhs, ?rhs, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_binary(bop, lhs, rhs, ast.ann_type(t));
+            e_1 = ast.expr_binary(bop, lhs, rhs,
+                                  ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_unary(?uop, ?sube, ?ann)) {
             // See note in expr_unary for why we're calling demand_full.
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
-            e_1 = ast.expr_unary(uop, sube, ast.ann_type(t));
+            e_1 = ast.expr_unary(uop, sube,
+                                 ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_lit(?lit, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_lit(lit, ast.ann_type(t));
+            e_1 = ast.expr_lit(lit, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_cast(?sube, ?ast_ty, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_cast(sube, ast_ty, ast.ann_type(t));
+            e_1 = ast.expr_cast(sube, ast_ty,
+                                ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_if(?cond, ?then_0, ?elifs_0, ?else_0, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
@@ -1115,62 +1132,71 @@ fn demand_expr_full(&@fn_ctxt fcx, @ty.t expected, @ast.expr e,
                     else_1 = some[ast.block](b_1);
                 }
             }
-            e_1 = ast.expr_if(cond, then_1, elifs_1, else_1, ast.ann_type(t));
+            e_1 = ast.expr_if(cond, then_1, elifs_1, else_1,
+                              ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_for(?decl, ?seq, ?bloc, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_for(decl, seq, bloc, ast.ann_type(t));
+            e_1 = ast.expr_for(decl, seq, bloc,
+                               ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_for_each(?decl, ?seq, ?bloc, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_for_each(decl, seq, bloc, ast.ann_type(t));
+            e_1 = ast.expr_for_each(decl, seq, bloc,
+                                    ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_while(?cond, ?bloc, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_while(cond, bloc, ast.ann_type(t));
+            e_1 = ast.expr_while(cond, bloc,
+                                 ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_do_while(?bloc, ?cond, ?ann)) {
             auto t = demand(fcx, e.span, expected, ann_to_type(ann));
-            e_1 = ast.expr_do_while(bloc, cond, ast.ann_type(t));
+            e_1 = ast.expr_do_while(bloc, cond,
+                                    ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_block(?bloc, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
-            e_1 = ast.expr_block(bloc, ast.ann_type(t));
+            e_1 = ast.expr_block(bloc, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_assign(?lhs_0, ?rhs_0, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
             auto lhs_1 = demand_expr(fcx, expected, lhs_0);
             auto rhs_1 = demand_expr(fcx, expected, rhs_0);
-            e_1 = ast.expr_assign(lhs_1, rhs_1, ast.ann_type(t));
+            e_1 = ast.expr_assign(lhs_1, rhs_1,
+                                  ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_assign_op(?op, ?lhs_0, ?rhs_0, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
             auto lhs_1 = demand_expr(fcx, expected, lhs_0);
             auto rhs_1 = demand_expr(fcx, expected, rhs_0);
-            e_1 = ast.expr_assign_op(op, lhs_1, rhs_1, ast.ann_type(t));
+            e_1 = ast.expr_assign_op(op, lhs_1, rhs_1,
+                                     ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_field(?lhs, ?rhs, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
-            e_1 = ast.expr_field(lhs, rhs, ast.ann_type(t));
+            e_1 = ast.expr_field(lhs, rhs, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_index(?base, ?index, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
-            e_1 = ast.expr_index(base, index, ast.ann_type(t));
+            e_1 = ast.expr_index(base, index,
+                                 ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_path(?pth, ?d, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
-            e_1 = ast.expr_path(pth, d, ast.ann_type(t));
+            e_1 = ast.expr_path(pth, d, ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_ext(?p, ?args, ?body, ?expanded, ?ann)) {
             auto t = demand_full(fcx, e.span, expected,
                                  ann_to_type(ann), adk);
-            e_1 = ast.expr_ext(p, args, body, expanded, ast.ann_type(t));
+            e_1 = ast.expr_ext(p, args, body, expanded,
+                               ast.ann_type(t, none[vec[@ty.t]]));
         }
         case (ast.expr_fail) { e_1 = e.node; }
         case (ast.expr_log(_)) { e_1 = e.node; }
@@ -1213,7 +1239,10 @@ fn writeback_local(&@fn_ctxt fcx, &span sp, @ast.local local)
                               + local.ident);
     }
     auto local_ty = fcx.locals.get(local.id);
-    auto local_wb = @rec(ann=ast.ann_type(local_ty) with *local);
+    auto local_wb = @rec(
+        ann=ast.ann_type(local_ty, none[vec[@ty.t]])
+        with *local
+    );
     ret @fold.respan[ast.decl_](sp, ast.decl_local(local_wb));
 }
 
@@ -1245,13 +1274,15 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
     auto new_pat;
     alt (pat.node) {
         case (ast.pat_wild(_)) {
-            new_pat = ast.pat_wild(ast.ann_type(next_ty_var(fcx.ccx)));
+            new_pat = ast.pat_wild(ast.ann_type(next_ty_var(fcx.ccx),
+                                                none[vec[@ty.t]]));
         }
         case (ast.pat_lit(?lt, _)) {
-            new_pat = ast.pat_lit(lt, ast.ann_type(check_lit(lt)));
+            new_pat = ast.pat_lit(lt, ast.ann_type(check_lit(lt),
+                                                   none[vec[@ty.t]]));
         }
         case (ast.pat_bind(?id, ?def_id, _)) {
-            auto ann = ast.ann_type(next_ty_var(fcx.ccx));
+            auto ann = ast.ann_type(next_ty_var(fcx.ccx), none[vec[@ty.t]]);
             new_pat = ast.pat_bind(id, def_id, ann);
         }
         case (ast.pat_tag(?p, ?subpats, ?vdef_opt, _)) {
@@ -1280,7 +1311,7 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
                         new_subpats += vec(check_pat(fcx, subpat));
                     }
 
-                    auto ann = ast.ann_type(tag_ty);
+                    auto ann = ast.ann_type(tag_ty, none[vec[@ty.t]]);
                     new_pat = ast.pat_tag(p, new_subpats, vdef_opt, ann);
                 }
 
@@ -1302,7 +1333,8 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
                     }
 
                     let vec[@ty.t] tys = vec(); // FIXME
-                    auto ann = ast.ann_type(plain_ty(ty.ty_tag(tid, tys)));
+                    auto ann = ast.ann_type(plain_ty(ty.ty_tag(tid, tys)),
+                                            none[vec[@ty.t]]);
                     new_pat = ast.pat_tag(p, subpats, vdef_opt, ann);
                 }
             }
@@ -1399,9 +1431,9 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
 
     alt (expr.node) {
         case (ast.expr_lit(?lit, _)) {
-            auto ty = check_lit(lit);
-            ret @fold.respan[ast.expr_](expr.span,
-                                        ast.expr_lit(lit, ast.ann_type(ty)));
+            auto typ = check_lit(lit);
+            auto ann = ast.ann_type(typ, none[vec[@ty.t]]);
+            ret @fold.respan[ast.expr_](expr.span, ast.expr_lit(lit, ann));
         }
 
 
@@ -1427,9 +1459,11 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                 case (ast.gt) { t = plain_ty(ty.ty_bool); }
                 case (_) { /* fall through */ }
             }
+
+            auto ann = ast.ann_type(t, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_binary(binop, lhs_1, rhs_1,
-                                                        ast.ann_type(t)));
+                                                        ann));
         }
 
 
@@ -1456,9 +1490,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                 }
                 case (_) { oper_t = strip_boxes(oper_t); }
             }
+
+            auto ann = ast.ann_type(oper_t, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
-                                        ast.expr_unary(unop, oper_1,
-                                                       ast.ann_type(oper_t)));
+                                        ast.expr_unary(unop, oper_1, ann));
         }
 
         case (ast.expr_path(?pth, ?defopt, _)) {
@@ -1552,17 +1587,18 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                 }
             }
 
+            auto ann = ast.ann_type(t, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
-                                        ast.expr_path(pth, defopt,
-                                                      ast.ann_type(t)));
+                                        ast.expr_path(pth, defopt, ann));
         }
 
         case (ast.expr_ext(?p, ?args, ?body, ?expanded, _)) {
             auto exp_ = check_expr(fcx, expanded);
             auto t = expr_ty(exp_);
+            auto ann = ast.ann_type(t, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_ext(p, args, body, exp_,
-                                                     ast.ann_type(t)));
+                                                     ann));
         }
 
         case (ast.expr_fail) {
@@ -1641,7 +1677,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             auto lhs_1 = demand_expr(fcx, rhs_t0, lhs_0);
             auto rhs_1 = demand_expr(fcx, expr_ty(lhs_1), rhs_0);
 
-            auto ann = ast.ann_type(rhs_t0);
+            auto ann = ast.ann_type(rhs_t0, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_assign(lhs_1, rhs_1, ann));
         }
@@ -1655,7 +1691,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             auto lhs_1 = demand_expr(fcx, rhs_t0, lhs_0);
             auto rhs_1 = demand_expr(fcx, expr_ty(lhs_1), rhs_0);
 
-            auto ann = ast.ann_type(rhs_t0);
+            auto ann = ast.ann_type(rhs_t0, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_assign_op(op, lhs_1, rhs_1,
                                                            ann));
@@ -1700,10 +1736,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
 
             auto thn_1 = demand_block(fcx, elsopt_t, thn_0);
 
+            auto ann = ast.ann_type(elsopt_t, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_if(cond_1, thn_1,
-                                                    elifs_1, elsopt_1,
-                                                    ast.ann_type(elsopt_t)));
+                                                    elifs_1, elsopt_1, ann));
         }
 
         case (ast.expr_for(?decl, ?seq, ?body, _)) {
@@ -1714,7 +1750,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             // FIXME: enforce that the type of the decl is the element type
             // of the seq.
 
-            auto ann = ast.ann_type(plain_ty(ty.ty_nil));
+            auto ann = ast.ann_type(plain_ty(ty.ty_nil), none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_for(decl_1, seq_1,
                                                      body_1, ann));
@@ -1725,7 +1761,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             auto seq_1 = check_expr(fcx, seq);
             auto body_1 = check_block(fcx, body);
 
-            auto ann = ast.ann_type(plain_ty(ty.ty_nil));
+            auto ann = ast.ann_type(plain_ty(ty.ty_nil), none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_for_each(decl_1, seq_1,
                                                           body_1, ann));
@@ -1736,7 +1772,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             auto cond_1 = demand_expr(fcx, plain_ty(ty.ty_bool), cond_0);
             auto body_1 = check_block(fcx, body);
 
-            auto ann = ast.ann_type(plain_ty(ty.ty_nil));
+            auto ann = ast.ann_type(plain_ty(ty.ty_nil), none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_while(cond_1, body_1, ann));
         }
@@ -1746,7 +1782,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             auto cond_1 = demand_expr(fcx, plain_ty(ty.ty_bool), cond_0);
             auto body_1 = check_block(fcx, body);
 
-            auto ann = ast.ann_type(block_ty(body_1));
+            auto ann = ast.ann_type(block_ty(body_1), none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_do_while(body_1, cond_1,
                                                           ann));
@@ -1796,7 +1832,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
 
             auto expr_1 = demand_expr(fcx, pattern_ty, expr_0);
 
-            auto ann = ast.ann_type(result_ty);
+            auto ann = ast.ann_type(result_ty, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_alt(expr_1, arms_1, ann));
         }
@@ -1806,10 +1842,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             auto ann;
             alt (b_0.node.expr) {
                 case (some[@ast.expr](?expr)) {
-                    ann = ast.ann_type(expr_ty(expr));
+                    ann = ast.ann_type(expr_ty(expr), none[vec[@ty.t]]);
                 }
                 case (none[@ast.expr]) {
-                    ann = ast.ann_type(plain_ty(ty.ty_nil));
+                    ann = ast.ann_type(plain_ty(ty.ty_nil), none[vec[@ty.t]]);
                 }
             }
             ret @fold.respan[ast.expr_](expr.span,
@@ -1849,9 +1885,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
             }
 
             auto t_1 = plain_ty(ty.ty_fn(proto_1, arg_tys_1, rt_1));
+            auto ann = ast.ann_type(t_1, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_bind(result._0, result._1,
-                                                      ast.ann_type(t_1)));
+                                                      ann));
         }
 
         case (ast.expr_call(?f, ?args, _)) {
@@ -1880,9 +1917,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                 }
             }
 
+            auto ann = ast.ann_type(rt_1, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_call(result._0, args_1,
-                                                      ast.ann_type(rt_1)));
+                                                      ann));
         }
 
         case (ast.expr_cast(?e, ?t, _)) {
@@ -1897,9 +1935,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                                       + " as "
                                       +  ty_to_str(t_1));
             }
+
+            auto ann = ast.ann_type(t_1, none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
-                                        ast.expr_cast(e_1, t,
-                                                      ast.ann_type(t_1)));
+                                        ast.expr_cast(e_1, t, ann));
         }
 
         case (ast.expr_vec(?args, _)) {
@@ -1922,7 +1961,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                 demand(fcx, expr.span, t, expr_t);
                 append[@ast.expr](args_1,expr_1);
             }
-            auto ann = ast.ann_type(plain_ty(ty.ty_vec(t)));
+            auto ann = ast.ann_type(plain_ty(ty.ty_vec(t)), none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_vec(args_1, ann));
         }
@@ -1941,7 +1980,8 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                 append[@ty.t](elts_t, expr_t);
             }
 
-            auto ann = ast.ann_type(plain_ty(ty.ty_tup(elts_t)));
+            auto ann = ast.ann_type(plain_ty(ty.ty_tup(elts_t)),
+                                    none[vec[@ty.t]]);
             ret @fold.respan[ast.expr_](expr.span,
                                         ast.expr_tup(elts_1, ann));
         }
@@ -1967,7 +2007,8 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
 
             alt (base) {
                 case (none[@ast.expr]) {
-                    ann = ast.ann_type(plain_ty(ty.ty_rec(fields_t)));
+                    ann = ast.ann_type(plain_ty(ty.ty_rec(fields_t)),
+                                       none[vec[@ty.t]]);
                 }
 
                 case (some[@ast.expr](?bexpr)) {
@@ -1987,7 +2028,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                         }
                     }
 
-                    ann = ast.ann_type(bexpr_t);
+                    ann = ast.ann_type(bexpr_t, none[vec[@ty.t]]);
 
                     for (ty.field f in fields_t) {
                         auto found = false;
@@ -2022,7 +2063,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                         fcx.ccx.sess.span_err(expr.span,
                                               "bad index on tuple");
                     }
-                    auto ann = ast.ann_type(args.(ix));
+                    auto ann = ast.ann_type(args.(ix), none[vec[@ty.t]]);
                     ret @fold.respan[ast.expr_](expr.span,
                                                 ast.expr_field(base_1,
                                                                field,
@@ -2036,7 +2077,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                         fcx.ccx.sess.span_err(expr.span,
                                               "bad index on record");
                     }
-                    auto ann = ast.ann_type(fields.(ix).ty);
+                    auto ann = ast.ann_type(fields.(ix).ty, none[vec[@ty.t]]);
                     ret @fold.respan[ast.expr_](expr.span,
                                                 ast.expr_field(base_1,
                                                                field,
@@ -2053,7 +2094,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                     auto meth = methods.(ix);
                     auto t = plain_ty(ty.ty_fn(meth.proto,
                                                meth.inputs, meth.output));
-                    auto ann = ast.ann_type(t);
+                    auto ann = ast.ann_type(t, none[vec[@ty.t]]);
                     ret @fold.respan[ast.expr_](expr.span,
                                                 ast.expr_field(base_1,
                                                                field,
@@ -2083,7 +2124,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                              "non-integral type of vec index: "
                              + ty_to_str(idx_t));
                     }
-                    auto ann = ast.ann_type(t);
+                    auto ann = ast.ann_type(t, none[vec[@ty.t]]);
                     ret @fold.respan[ast.expr_](expr.span,
                                                 ast.expr_index(base_1,
                                                                idx_1,
@@ -2097,7 +2138,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
                              + ty_to_str(idx_t));
                     }
                     auto t = ty.ty_machine(common.ty_u8);
-                    auto ann = ast.ann_type(plain_ty(t));
+                    auto ann = ast.ann_type(plain_ty(t), none[vec[@ty.t]]);
                     ret @fold.respan[ast.expr_](expr.span,
                                                 ast.expr_index(base_1,
                                                                idx_1,
@@ -2272,7 +2313,7 @@ fn check_item_fn(&@crate_ctxt ccx, &span sp, ast.ident ident, &ast._fn f,
 
     auto output_ty = ast_ty_to_ty_crate(ccx, f.decl.output);
     auto fn_sty = ty.ty_fn(f.proto, inputs, output_ty);
-    auto fn_ann = ast.ann_type(plain_ty(fn_sty));
+    auto fn_ann = ast.ann_type(plain_ty(fn_sty), none[vec[@ty.t]]);
 
     auto item = ast.item_fn(ident, f, ty_params, id, fn_ann);
     ret @fold.respan[ast.item_](sp, item);