@@ -2284,29 +2284,17 @@ and normalize_expr ?guard info (node_id : NI.t option) map =
22842284 let nexpr = A. Ident (pos, name) in
22852285 nexpr, union (union gids1 gids2) gids3, warnings1 @ warnings2
22862286 | StructUpdate (pos , expr1 , [A. MapIndex (_ , expr2 )], Some expr3 ) as expr ->
2287- let gids1, warnings1 = match AH. find_type_annotation expr1 with
2288- | Some (Map (_ , kt , vt )) ->
2289- let gids, warnings = mk_fresh_refinement_type_constraint Local info map pos node_id expr2 kt in
2290- let gids', warnings' = mk_fresh_refinement_type_constraint Local info map pos node_id expr3 vt in
2291- let gids'', warnings'' = mk_fresh_subrange_constraint ~force_prop: true Local info map pos node_id expr2 kt in
2292- let gids''' , warnings''' = mk_fresh_subrange_constraint ~force_prop: true Local info map pos node_id expr3 vt in
2293- let gids = List. fold_left union (empty () ) [gids; gids'; gids''; gids''' ] in
2294- let warnings = warnings @ warnings' @ warnings'' @ warnings''' in
2295- gids, warnings
2296- | None -> empty () , []
2297- | _ -> assert false (* Type annotation must be `Map` type, enforced by the parser *)
2298- in
22992287 (* Don't supply the guard when normalizing subexpressions,
23002288 because we need to generate oracle variables in initial step
23012289 if there are unguarded pres *)
2302- let nexpr1, gids2 , _ = normalize_expr info node_id map expr1 in
2303- let nexpr2, gids3 , _ = normalize_expr info node_id map expr2 in
2304- let nexpr3, gids4 , _ = normalize_expr info node_id map expr3 in
2290+ let nexpr1, gids1 , _ = normalize_expr info node_id map expr1 in
2291+ let nexpr2, gids2 , _ = normalize_expr info node_id map expr2 in
2292+ let nexpr3, gids3 , _ = normalize_expr info node_id map expr3 in
23052293 (* Hacky: to generate correct user-facing warnings, we call normalize_expr
23062294 while supplying the guard, but ignore all other outputs *)
2307- let _, _, warnings2 = normalize_expr ?guard info node_id map expr1 in
2308- let _, _, warnings3 = normalize_expr ?guard info node_id map expr2 in
2309- let _, _, warnings4 = normalize_expr ?guard info node_id map expr3 in
2295+ let _, _, warnings1 = normalize_expr ?guard info node_id map expr1 in
2296+ let _, _, warnings2 = normalize_expr ?guard info node_id map expr2 in
2297+ let _, _, warnings3 = normalize_expr ?guard info node_id map expr3 in
23102298 i := ! i + 1 ;
23112299 let prefix = HString. mk_hstring (string_of_int ! i) in
23122300 let name1 = HString. concat2 prefix (HString. mk_hstring " _map_update" ) in
@@ -2318,30 +2306,23 @@ and normalize_expr ?guard info (node_id : NI.t option) map =
23182306 (* Use base types *)
23192307 let kt = Chk. expand_type_syn_reftype_history_subrange info.context kt |> Result. get_ok in
23202308 let vt = Chk. expand_type_syn_reftype_history_subrange info.context vt |> Result. get_ok in
2321- let gids5 = { (empty () ) with
2309+ let gids4 = { (empty () ) with
23222310 map_element_updates = [ name1, nexpr1, nexpr2, nexpr3, name2, kt, vt ];
23232311 locals = StringMap. add name2 kt (StringMap. singleton name1 (A. Map (pos, kt, vt)));
23242312 } in
23252313 let nexpr = A. Ident (pos, name1) in
2326- let gids = List. fold_left union (empty () ) [gids1; gids2; gids3; gids4; gids5 ] in
2327- nexpr, gids, warnings1 @ warnings2 @ warnings3 @ warnings4
2314+ let gids = List. fold_left union (empty () ) [gids1; gids2; gids3; gids4] in
2315+ nexpr, gids, warnings1 @ warnings2 @ warnings3
23282316 | StructUpdate (pos , expr1 , [A. SetIndex (_ , expr2 )], None) as expr ->
2329- let gids1, warnings1 = match AH. find_type_annotation expr1 with
2330- | Some ty ->
2331- let gids, warnings = mk_fresh_refinement_type_constraint Local info map pos node_id expr2 ty in
2332- let gids', warnings' = mk_fresh_subrange_constraint ~force_prop: true Local info map pos node_id expr2 ty in
2333- union gids gids', warnings @ warnings'
2334- | None -> empty () , []
2335- in
23362317 (* Don't supply the guard when normalizing subexpressions,
23372318 because we need to generate oracle variables in initial step
23382319 if there are unguarded pres *)
2339- let nexpr1, gids2 , _ = normalize_expr info node_id map expr1 in
2340- let nexpr2, gids3 , _ = normalize_expr info node_id map expr2 in
2320+ let nexpr1, gids1 , _ = normalize_expr info node_id map expr1 in
2321+ let nexpr2, gids2 , _ = normalize_expr info node_id map expr2 in
23412322 (* Hacky: to generate correct user-facing warnings, we call normalize_expr
23422323 while supplying the guard, but ignore all other outputs *)
2343- let _, _, warnings2 = normalize_expr ?guard info node_id map expr1 in
2344- let _, _, warnings3 = normalize_expr ?guard info node_id map expr2 in
2324+ let _, _, warnings1 = normalize_expr ?guard info node_id map expr1 in
2325+ let _, _, warnings2 = normalize_expr ?guard info node_id map expr2 in
23452326 i := ! i + 1 ;
23462327 let prefix = HString. mk_hstring (string_of_int ! i) in
23472328 let name1 = HString. concat2 prefix (HString. mk_hstring " _set_update" ) in
@@ -2352,13 +2333,13 @@ and normalize_expr ?guard info (node_id : NI.t option) map =
23522333 in
23532334 (* Use base types *)
23542335 let ty = Chk. expand_type_syn_reftype_history_subrange info.context ty |> Result. get_ok in
2355- let gids4 = { (empty () ) with
2336+ let gids3 = { (empty () ) with
23562337 set_insertions = [ name1, nexpr1, nexpr2, name2, ty ];
23572338 locals = StringMap. add name2 ty (StringMap. singleton name1 (A. Set (pos, ty)));
23582339 } in
23592340 let nexpr = A. Ident (pos, name1) in
2360- let gids = List. fold_left union (empty () ) [gids1; gids2; gids3; gids4 ] in
2361- nexpr, gids, warnings1 @ warnings2 @ warnings3
2341+ let gids = List. fold_left union (empty () ) [gids1; gids2; gids3] in
2342+ nexpr, gids, warnings1 @ warnings2
23622343
23632344 | RecordProject (pos , expr , i ) ->
23642345 let nexpr, gids, warnings = normalize_expr ?guard info node_id map expr in
0 commit comments