From c27642baf05c9fefb343963dc94cda1843b07d1e Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Sun, 13 Oct 2024 13:32:05 -0400 Subject: [PATCH] Stop recalculating statics in tests --- test/Test_Statics.re | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/Test_Statics.re b/test/Test_Statics.re index 029cececd8..4734ff342d 100644 --- a/test/Test_Statics.re +++ b/test/Test_Statics.re @@ -34,8 +34,12 @@ let id_at = x => x |> List.nth(ids); let statics = Statics.mk(CoreSettings.on, Builtins.ctx_init); let alco_check = Alcotest.option(testable_typ) |> Alcotest.check; -let info_of_id = (f: UExp.t, id: Id.t) => { - let s = statics(f); +let info_of_id = (~statics_map=?, f: UExp.t, id: Id.t) => { + let s = + switch (statics_map) { + | Some(s) => s + | None => statics(f) + }; switch (Id.Map.find(id, s)) { | InfoExp(ie) => Some(ie) | _ => None @@ -43,8 +47,11 @@ let info_of_id = (f: UExp.t, id: Id.t) => { }; // Get the type from the statics -let type_of = f => { - Option.map((ie: Info.exp) => ie.ty, info_of_id(f, IdTagged.rep_id(f))); +let type_of = (~statics_map=?, f) => { + Option.map( + (ie: Info.exp) => ie.ty, + info_of_id(~statics_map?, f, IdTagged.rep_id(f)), + ); }; let fully_consistent_typecheck = (name, serialized, expected, exp) => { @@ -65,7 +72,7 @@ let fully_consistent_typecheck = (name, serialized, expected, exp) => { Statics.Map.error_ids(s), ); Alcotest.check(list(status_exp), "Static Errors", [], errors); - alco_check(serialized, expected, type_of(exp)); + alco_check(serialized, expected, type_of(~statics_map=s, exp)); }, ); };