summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Interpreter.ml12
-rw-r--r--src/Substitute.ml2
-rw-r--r--src/main.ml6
3 files changed, 12 insertions, 8 deletions
diff --git a/src/Interpreter.ml b/src/Interpreter.ml
index 47b389a3..99ef8357 100644
--- a/src/Interpreter.ml
+++ b/src/Interpreter.ml
@@ -2364,12 +2364,12 @@ let fun_def_is_unit (def : A.fun_def) : bool =
(** Test all the unit functions in a list of function definitions *)
let test_all_unit_functions (type_defs : T.type_def T.TypeDefId.vector)
- (fun_defs : A.fun_def A.FunDefId.vector) : bool =
- let test_fun (def : A.fun_def) : bool =
+ (fun_defs : A.fun_def A.FunDefId.vector) : unit =
+ let test_fun (def : A.fun_def) : unit =
if fun_def_is_unit def then
match test_unit_function type_defs fun_defs def.A.def_id with
- | Error _ -> false
- | Ok _ -> true
- else true
+ | Error _ -> failwith "Unit test failed"
+ | Ok _ -> ()
+ else ()
in
- A.FunDefId.for_all test_fun fun_defs
+ A.FunDefId.iter test_fun fun_defs
diff --git a/src/Substitute.ml b/src/Substitute.ml
index cad61595..452b125f 100644
--- a/src/Substitute.ml
+++ b/src/Substitute.ml
@@ -63,7 +63,7 @@ let type_def_get_instantiated_field_type (def : T.type_def)
(T.TypeVarId.vector_to_list def.T.type_params))
types
in
- let fields = type_def_get_fields def opt_variant_id in
+ let fields = T.type_def_get_fields def opt_variant_id in
T.FieldId.map
(fun f -> erase_regions_substitute_types ty_subst f.T.field_ty)
fields
diff --git a/src/main.ml b/src/main.ml
index 183df8f5..39f1cf0c 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -3,6 +3,7 @@ open Logging
open Print
module T = Types
module A = CfimAst
+module I = Interpreter
(* This is necessary to have a backtrace when raising exceptions - for some
* reason, the -g option doesn't work *)
@@ -14,4 +15,7 @@ let () =
| Error s -> log#error "error: %s\n" s
| Ok m ->
(* Print the module *)
- log#ldebug (lazy ("\n" ^ Print.Module.module_to_string m))
+ log#ldebug (lazy ("\n" ^ Print.Module.module_to_string m));
+
+ (* Test the unit functions *)
+ I.test_all_unit_functions m.types m.functions