diff options
author | Son Ho | 2021-11-25 16:41:21 +0100 |
---|---|---|
committer | Son Ho | 2021-11-25 16:41:21 +0100 |
commit | a9995fe949d31e0f53b1e3e26908de8f98972ca5 (patch) | |
tree | e6dab293d1b4a7d89b11b7bd362fc3e5f68117d6 | |
parent | e424524f8f8d9217e78ae05dbcc157bad5d471d2 (diff) |
Finish the implementation of set_discriminant
-rw-r--r-- | src/Interpreter.ml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Interpreter.ml b/src/Interpreter.ml index d1b264f1..74cbe70d 100644 --- a/src/Interpreter.ml +++ b/src/Interpreter.ml @@ -1870,17 +1870,24 @@ let set_discriminant (config : C.config) (ctx : C.eval_ctx) (p : E.place) else (* Replace the value *) let bottom_v = - compute_expanded_bottom_adt_value ctx.type_context def_id + compute_expanded_bottom_adt_value ctx2.type_context def_id (Some variant_id) regions types in let env3 = write_place_unwrap config access p bottom_v ctx2.env in let ctx3 = { ctx2 with env = env3 } in Ok (ctx3, Unit)) - | _, V.Bottom -> raise Unimplemented + | T.Adt (def_id, regions, types), V.Bottom -> + let bottom_v = + compute_expanded_bottom_adt_value ctx2.type_context def_id + (Some variant_id) regions types + in + let env3 = write_place_unwrap config access p bottom_v ctx2.env in + let ctx3 = { ctx2 with env = env3 } in + Ok (ctx3, Unit) | _, V.Symbolic _ -> assert (config.mode = SymbolicMode); (* TODO *) raise Unimplemented - | _, V.Adt _ -> failwith "Inconsistent state" + | _, (V.Adt _ | V.Bottom) -> failwith "Inconsistent state" | _, (V.Concrete _ | V.Tuple _ | V.Borrow _ | V.Loan _ | V.Assumed _) -> failwith "Unexpected value" |