Skip to content

Commit cdcab74

Browse files
committed
Fix fold bug on expr_unary.
1 parent df5f8f3 commit cdcab74

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/comp/middle/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
404404

405405
case (ast.expr_unary(?op, ?a, ?t)) {
406406
auto aa = fold_expr(env_, fld, a);
407-
ret fld.fold_expr_unary(env_, e.span, op, a, t);
407+
ret fld.fold_expr_unary(env_, e.span, op, aa, t);
408408
}
409409

410410
case (ast.expr_lit(?lit, ?t)) {

src/comp/middle/typeck.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty {
271271

272272
case (ast.ty_path(?path, ?def)) {
273273
auto def_id;
274+
check (def != none[ast.def]);
274275
alt (option.get[ast.def](def)) {
275276
case (ast.def_ty(?id)) { def_id = id; }
276277
case (_) { fail; }
@@ -1247,6 +1248,7 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
12471248

12481249
case (ast.expr_name(?name, ?defopt, _)) {
12491250
auto t = plain_ty(ty_nil);
1251+
check (defopt != none[ast.def]);
12501252
alt (option.get[ast.def](defopt)) {
12511253
case (ast.def_arg(?id)) {
12521254
check (fcx.locals.contains_key(id));

0 commit comments

Comments
 (0)