summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSon Ho2022-01-26 23:20:54 +0100
committerSon Ho2022-01-26 23:20:54 +0100
commitb1105c75ea54f38155ca86c62711082ce0bc325d (patch)
tree1e215c20ef957cebfd4d8fb068f291a6f67d27f3 /src
parent3e36b8c3b81a64d5f85dbff0f171741bb4c03423 (diff)
Fix various issues
Diffstat (limited to 'src')
-rw-r--r--src/InterpreterBorrows.ml1
-rw-r--r--src/Invariants.ml11
-rw-r--r--src/Print.ml4
-rw-r--r--src/main.ml4
4 files changed, 15 insertions, 5 deletions
diff --git a/src/InterpreterBorrows.ml b/src/InterpreterBorrows.ml
index b231722d..d2964c90 100644
--- a/src/InterpreterBorrows.ml
+++ b/src/InterpreterBorrows.ml
@@ -454,6 +454,7 @@ let give_back_symbolic_value (_config : C.config)
V.AProjBorrows (nsv, sv.V.sv_ty)
| _ -> failwith "Unreachable"
in
+ (* TODO: this actually doesn't work, or at least there is something subtle... *)
V.AProjLoans (sv, (mv, child_proj) :: local_given_back)
in
update_intersecting_aproj_loans proj_regions proj_ty sv subst ctx
diff --git a/src/Invariants.ml b/src/Invariants.ml
index ee58a1a3..2d26404d 100644
--- a/src/Invariants.ml
+++ b/src/Invariants.ml
@@ -595,13 +595,22 @@ let check_typing_invariant (ctx : C.eval_ctx) : unit =
| V.ASymbolic aproj, ty -> (
let ty1 = Subst.erase_regions ty in
match aproj with
- | V.AProjLoans (sv, _) | V.AProjBorrows (sv, _) ->
+ | V.AProjLoans (sv, _) ->
let ty2 = Subst.erase_regions sv.V.sv_ty in
assert (ty1 = ty2);
(* Also check that the symbolic values contain regions of interest -
* otherwise they should have been reduced to `_` *)
let abs = Option.get info in
+ log#ldebug (lazy (symbolic_value_to_string ctx sv));
assert (ty_has_regions_in_set abs.regions sv.V.sv_ty)
+ | V.AProjBorrows (sv, proj_ty) ->
+ let ty2 = Subst.erase_regions sv.V.sv_ty in
+ assert (ty1 = ty2);
+ (* Also check that the symbolic values contain regions of interest -
+ * otherwise they should have been reduced to `_` *)
+ let abs = Option.get info in
+ log#ldebug (lazy (symbolic_value_to_string ctx sv));
+ assert (ty_has_regions_in_set abs.regions proj_ty)
| V.AEndedProjLoans (_msv, given_back_ls) ->
List.iter
(fun (_, proj) ->
diff --git a/src/Print.ml b/src/Print.ml
index da6158b5..e1834ca6 100644
--- a/src/Print.ml
+++ b/src/Print.ml
@@ -317,9 +317,9 @@ module Values = struct
let given_back = List.map (aproj_to_string fmt) given_back in
" (" ^ String.concat "," given_back ^ ") "
in
- "["
+ "⌊"
^ symbolic_value_to_string (value_to_rtype_formatter fmt) sv
- ^ given_back ^ "]"
+ ^ given_back ^ "⌋"
| AProjBorrows (sv, rty) ->
"(" ^ symbolic_value_proj_to_string fmt sv rty ^ ")"
| AEndedProjLoans (_, given_back) ->
diff --git a/src/main.ml b/src/main.ml
index 2e1e552e..e803c49c 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -55,7 +55,7 @@ let () =
expressions_log#set_level EL.Debug;
expansion_log#set_level EL.Debug;
borrows_log#set_level EL.Debug;
- invariants_log#set_level EL.Warning;
+ invariants_log#set_level EL.Debug;
(* Load the module *)
let json = Yojson.Basic.from_file !filename in
match cfim_module_of_json json with
@@ -68,7 +68,7 @@ let () =
let config =
{
C.check_invariants = true;
- greedy_expand_symbolics_with_borrows = false;
+ greedy_expand_symbolics_with_borrows = true;
}
in