Skip to content

Commit 5dd05f1

Browse files
committed
---
yaml --- r: 2975 b: refs/heads/master c: cc06bd4 h: refs/heads/master i: 2973: 60b6113 2971: 8512405 2967: 152607f 2959: f152b03 2943: 3f3608b v: v3
1 parent 22f9e0b commit 5dd05f1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
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: b02b50c695dd6c79f1ca5ab77e3ce432071d943b
2+
refs/heads/master: cc06bd4aa5c2e6573c67098158620f7233d15995

trunk/src/comp/middle/typeck.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,8 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
16281628
assert (ast::is_call_expr(e));
16291629

16301630
check_expr(fcx, e);
1631+
demand::simple(fcx, e.span, fcx.ret_ty, expr_ty(fcx.ccx.tcx, e));
1632+
16311633
write::nil_ty(fcx.ccx.tcx, a.id);
16321634
}
16331635

@@ -1713,7 +1715,11 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
17131715
auto lhs_t = expr_ty(fcx.ccx.tcx, lhs);
17141716
alt (struct(fcx.ccx.tcx, lhs_t)) {
17151717
case (ty::ty_chan(?it)) { item_t = it; }
1716-
case (_) { fail; }
1718+
case (_) {
1719+
fcx.ccx.tcx.sess.span_err(expr.span,
1720+
#fmt("mismatched types: expected chan but found %s",
1721+
ty_to_str(fcx.ccx.tcx, lhs_t)));
1722+
}
17171723
}
17181724

17191725
write::ty_only_fixup(fcx, a.id, chan_t);
@@ -1742,6 +1748,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
17421748

17431749
auto thn_t = block_ty(fcx.ccx.tcx, thn);
17441750
auto elsopt_t = expr_ty(fcx.ccx.tcx, els);
1751+
1752+
demand::simple(fcx, expr.span, thn_t, elsopt_t);
1753+
17451754
if (!ty::type_is_bot(fcx.ccx.tcx, elsopt_t)) {
17461755
elsopt_t
17471756
} else {
@@ -1790,6 +1799,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
17901799
check_expr(fcx, cond);
17911800
check_block(fcx, body);
17921801

1802+
demand::simple(fcx, cond.span, ty::mk_bool(fcx.ccx.tcx),
1803+
expr_ty(fcx.ccx.tcx, cond));
1804+
17931805
auto typ = ty::mk_nil(fcx.ccx.tcx);
17941806
write::ty_only_fixup(fcx, a.id, typ);
17951807
}

0 commit comments

Comments
 (0)