File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: a599d80e98bcae932832d20591bc1b14d3de8c20
2
+ refs/heads/master: 9c0c0af1b225bc26c0b73434221efe6ffbb373c3
Original file line number Diff line number Diff line change @@ -924,7 +924,9 @@ fn collect_item_types(session.session sess, @ast.crate crate)
924
924
fn unify( & @fn_ctxt fcx, @ty. t expected, @ty. t actual) -> ty. unify_result {
925
925
obj unify_handler( @fn_ctxt fcx) {
926
926
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
+ }
928
930
ret fcx. locals. get( id) ;
929
931
}
930
932
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 {
2377
2379
alt ( decl. node) {
2378
2380
case ( ast. decl_local( ?local) ) {
2379
2381
2380
- auto local_ty;
2381
2382
alt ( local. ty) {
2382
2383
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.
2385
2385
}
2386
2386
2387
2387
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) ;
2389
2390
}
2390
2391
}
2391
- fcx. locals. insert( local. id, local_ty) ;
2392
2392
2393
- auto rhs_ty = local_ty;
2394
2393
auto init = local. init;
2395
2394
alt ( local. init) {
2396
2395
case ( some[ @ast. expr] ( ?expr) ) {
You can’t perform that action at this time.
0 commit comments