Skip to content

Commit 6f7fc18

Browse files
committed
---
yaml --- r: 1717 b: refs/heads/master c: 9c0c0af h: refs/heads/master i: 1715: da47048 v: v3
1 parent 016d9fc commit 6f7fc18

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
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: a599d80e98bcae932832d20591bc1b14d3de8c20
2+
refs/heads/master: 9c0c0af1b225bc26c0b73434221efe6ffbb373c3

trunk/src/comp/middle/typeck.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,9 @@ fn collect_item_types(session.session sess, @ast.crate crate)
924924
fn unify(&@fn_ctxt fcx, @ty.t expected, @ty.t actual) -> ty.unify_result {
925925
obj unify_handler(@fn_ctxt fcx) {
926926
fn resolve_local(ast.def_id id) -> @ty.t {
927-
check (fcx.locals.contains_key(id));
927+
if (!fcx.locals.contains_key(id)) {
928+
ret next_ty_var(fcx.ccx);
929+
}
928930
ret fcx.locals.get(id);
929931
}
930932
fn record_local(ast.def_id id, @ty.t t) {
@@ -2377,20 +2379,17 @@ fn check_decl_local(&@fn_ctxt fcx, &@ast.decl decl) -> @ast.decl {
23772379
alt (decl.node) {
23782380
case (ast.decl_local(?local)) {
23792381

2380-
auto local_ty;
23812382
alt (local.ty) {
23822383
case (none[@ast.ty]) {
2383-
// Auto slot. Assign a ty_var.
2384-
local_ty = next_ty_var(fcx.ccx);
2384+
// Auto slot. Do nothing for now.
23852385
}
23862386

23872387
case (some[@ast.ty](?ast_ty)) {
2388-
local_ty = ast_ty_to_ty_crate(fcx.ccx, ast_ty);
2388+
auto local_ty = ast_ty_to_ty_crate(fcx.ccx, ast_ty);
2389+
fcx.locals.insert(local.id, local_ty);
23892390
}
23902391
}
2391-
fcx.locals.insert(local.id, local_ty);
23922392

2393-
auto rhs_ty = local_ty;
23942393
auto init = local.init;
23952394
alt (local.init) {
23962395
case (some[@ast.expr](?expr)) {

0 commit comments

Comments
 (0)