Skip to content

Commit c3572fd

Browse files
committed
---
yaml --- r: 2508 b: refs/heads/master c: 8a8f68a h: refs/heads/master v: v3
1 parent 43b0446 commit c3572fd

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: ae26b775b4ae4a1405effefb015ec44f0311c29f
2+
refs/heads/master: 8a8f68aa7575dd9a052b6cee4fd167e43b1b632f

trunk/src/comp/middle/typeck.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,12 @@ fn ty_param_count_and_ty_for_def(&@fn_ctxt fcx, &ast::span sp, &ast::def defn)
177177
}
178178
}
179179

180+
type ty_param_substs_opt_and_ty = tup(option::t[vec[ty::t]], ty::t);
181+
180182
// Instantiates the given path, which must refer to an item with the given
181183
// number of type parameters and type.
182184
fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
183-
&span sp, uint ann_tag) -> ast::ann {
185+
&span sp) -> ty_param_substs_opt_and_ty {
184186
auto ty_param_count = tpt._0;
185187
auto t = bind_params_in_type(fcx.ccx.tcx, tpt._1);
186188

@@ -211,7 +213,7 @@ fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
211213
ty_substs_opt = some[vec[ty::t]](ty_substs);
212214
}
213215

214-
ret ast::ann_type(ann_tag, t, ty_substs_opt, none[@ts_ann]);
216+
ret tup(ty_substs_opt, t);
215217
}
216218

217219
fn ast_mode_to_mode(ast::mode mode) -> ty::mode {
@@ -1656,8 +1658,8 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat) -> @ast::pat {
16561658

16571659
auto tpt = ty::lookup_item_type(fcx.ccx.sess, fcx.ccx.tcx,
16581660
fcx.ccx.type_cache, vdef._0);
1659-
auto ann = instantiate_path(fcx, p, tpt, pat.span,
1660-
ast::ann_tag(old_ann));
1661+
1662+
auto path_tpot = instantiate_path(fcx, p, tpt, pat.span);
16611663

16621664
alt (struct(fcx.ccx.tcx, t)) {
16631665
// N-ary variants have function types.
@@ -1681,7 +1683,9 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat) -> @ast::pat {
16811683
new_subpats += vec(check_pat(fcx, subpat));
16821684
}
16831685

1684-
new_pat = ast::pat_tag(p, new_subpats, ann);
1686+
new_pat = ast::pat_tag(p, new_subpats,
1687+
ast::ann_type(ast::ann_tag(old_ann), path_tpot._1,
1688+
path_tpot._0, none[@ts_ann]));
16851689
}
16861690

16871691
// Nullary variants have tag types.
@@ -1699,7 +1703,9 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat) -> @ast::pat {
16991703
fail; // TODO: recover
17001704
}
17011705

1702-
new_pat = ast::pat_tag(p, subpats, ann);
1706+
new_pat = ast::pat_tag(p, subpats,
1707+
ast::ann_type(ast::ann_tag(old_ann), path_tpot._1,
1708+
path_tpot._0, none[@ts_ann]));
17031709
}
17041710
}
17051711
}
@@ -1946,10 +1952,11 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) -> @ast::expr {
19461952
auto tpt = ty_param_count_and_ty_for_def(fcx, expr.span, defn);
19471953

19481954
if (ty::def_has_ty_params(defn)) {
1949-
auto ann = instantiate_path(fcx, pth, tpt, expr.span,
1950-
ast::ann_tag(old_ann));
1955+
auto path_tpot = instantiate_path(fcx, pth, tpt, expr.span);
19511956
ret @fold::respan[ast::expr_](expr.span,
1952-
ast::expr_path(pth, ann));
1957+
ast::expr_path(pth,
1958+
ast::ann_type(ast::ann_tag(old_ann), path_tpot._1,
1959+
path_tpot._0, none[@ts_ann])));
19531960
}
19541961

19551962
// The definition doesn't take type parameters. If the programmer

0 commit comments

Comments
 (0)