Swap the expected/actual for typechecking fields of updated records

In 'rec(a = b with c)', if a exists in c then the expected type for b is the
type of c.
This commit is contained in:
Brian Anderson 2011-07-06 13:36:27 -07:00
parent 05954f37b7
commit 0eac640fdd
2 changed files with 11 additions and 2 deletions

View file

@ -2120,8 +2120,8 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
auto found = false;
for (ty::field bf in base_fields) {
if (str::eq(f.ident, bf.ident)) {
demand::simple(fcx, expr.span, f.mt.ty,
bf.mt.ty);
demand::simple(fcx, expr.span, bf.mt.ty,
f.mt.ty);
found = true;
}
}