@@ -1628,6 +1628,8 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
1628
1628
assert ( ast:: is_call_expr( e) ) ;
1629
1629
1630
1630
check_expr( fcx, e) ;
1631
+ demand:: simple( fcx, e. span, fcx. ret_ty, expr_ty( fcx. ccx. tcx, e) ) ;
1632
+
1631
1633
write:: nil_ty( fcx. ccx. tcx, a. id) ;
1632
1634
}
1633
1635
@@ -1713,7 +1715,11 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
1713
1715
auto lhs_t = expr_ty( fcx. ccx. tcx, lhs) ;
1714
1716
alt ( struct ( fcx. ccx. tcx, lhs_t) ) {
1715
1717
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
+ }
1717
1723
}
1718
1724
1719
1725
write:: ty_only_fixup( fcx, a. id, chan_t) ;
@@ -1742,6 +1748,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
1742
1748
1743
1749
auto thn_t = block_ty( fcx. ccx. tcx, thn) ;
1744
1750
auto elsopt_t = expr_ty( fcx. ccx. tcx, els) ;
1751
+
1752
+ demand:: simple( fcx, expr. span, thn_t, elsopt_t) ;
1753
+
1745
1754
if ( !ty:: type_is_bot( fcx. ccx. tcx, elsopt_t) ) {
1746
1755
elsopt_t
1747
1756
} else {
@@ -1790,6 +1799,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
1790
1799
check_expr( fcx, cond) ;
1791
1800
check_block( fcx, body) ;
1792
1801
1802
+ demand:: simple( fcx, cond. span, ty:: mk_bool( fcx. ccx. tcx) ,
1803
+ expr_ty( fcx. ccx. tcx, cond) ) ;
1804
+
1793
1805
auto typ = ty:: mk_nil( fcx. ccx. tcx) ;
1794
1806
write:: ty_only_fixup( fcx, a. id, typ) ;
1795
1807
}
0 commit comments