Fix fold bug on expr_unary.

This commit is contained in:
Graydon Hoare 2010-12-02 15:54:45 -08:00
parent df5f8f3e37
commit cdcab742a7
2 changed files with 3 additions and 1 deletions

View File

@ -404,7 +404,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
case (ast.expr_unary(?op, ?a, ?t)) {
auto aa = fold_expr(env_, fld, a);
ret fld.fold_expr_unary(env_, e.span, op, a, t);
ret fld.fold_expr_unary(env_, e.span, op, aa, t);
}
case (ast.expr_lit(?lit, ?t)) {

View File

@ -271,6 +271,7 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty {
case (ast.ty_path(?path, ?def)) {
auto def_id;
check (def != none[ast.def]);
alt (option.get[ast.def](def)) {
case (ast.def_ty(?id)) { def_id = id; }
case (_) { fail; }
@ -1247,6 +1248,7 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ast.expr_name(?name, ?defopt, _)) {
auto t = plain_ty(ty_nil);
check (defopt != none[ast.def]);
alt (option.get[ast.def](defopt)) {
case (ast.def_arg(?id)) {
check (fcx.locals.contains_key(id));