Skip to content

Commit 8d10594

Browse files
author
Eric Holk
committed
Added a few more expr_spawn cases so the spawn.rs test case gets a little further before failing.
1 parent 37768cb commit 8d10594

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/comp/middle/ty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,7 @@ fn expr_ann(&@ast::expr e) -> ast::ann {
17431743
case (ast::expr_break(?a)) { ret a; }
17441744
case (ast::expr_cont(?a)) { ret a; }
17451745
case (ast::expr_self_method(_, ?a)) { ret a; }
1746+
case (ast::expr_spawn(_, _, _, _, ?a)) { ret a; }
17461747
}
17471748
}
17481749

src/comp/middle/typeck.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,22 @@ mod Pushdown {
15091509
e_1 = ast::expr_send(lval_1, expr_1, ann);
15101510
}
15111511

1512+
case (ast::expr_spawn(?dom, ?name, ?func, ?args, ?ann)) {
1513+
// TODO: This is copied from call, since spawn is sort of like
1514+
// a call expression. However, it's not doing anything with
1515+
// the domain or name parameters.
1516+
1517+
// NB: we call 'Demand::autoderef' and pass in adk only in
1518+
// cases where e is an expression that could *possibly*
1519+
// produce a box; things like expr_binary or expr_bind can't,
1520+
// so there's no need.
1521+
auto t = Demand::autoderef(fcx, e.span, expected,
1522+
ann_to_type(fcx.ccx.node_types, ann), adk);
1523+
e_1 = ast::expr_spawn(dom, name, func, args,
1524+
triv_ann(ast::ann_tag(ann), t));
1525+
write_type_only(fcx.ccx.node_types, ast::ann_tag(ann), t);
1526+
}
1527+
15121528
case (_) {
15131529
fcx.ccx.sess.span_unimpl(e.span,
15141530
#fmt("type unification for expression variant: %s",

0 commit comments

Comments
 (0)