From e46bb3e8d8c5f65f2cd881460c87f702cf8ea842 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sat, 27 Sep 2025 07:57:29 -0400 Subject: [PATCH] Fix CI --- src/check/unify.zig | 10 ++++++++++ src/eval/test_runner.zig | 4 ++-- src/interpreter_shim/main.zig | 2 +- src/playground_wasm/main.zig | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/check/unify.zig b/src/check/unify.zig index 5d5048dc53..3f5cc4a60a 100644 --- a/src/check/unify.zig +++ b/src/check/unify.zig @@ -1367,6 +1367,12 @@ fn Unifier(comptime StoreTypeB: type) type { } self.merge(vars, vars.b.desc.content); }, + .frac_precision => |prec| { + // Promote decimal integers to the concrete fractional precision. + // Any fractional precision can represent integer literals, so no + // additional requirement checks are needed here. + self.merge(vars, Content{ .structure = .{ .num = .{ .frac_precision = prec } } }); + }, .frac_unbound => |b_requirements| { // When unifying num_unbound with frac_unbound, frac wins self.merge(vars, Content{ .structure = .{ .num = .{ .frac_unbound = b_requirements } } }); @@ -1500,6 +1506,10 @@ fn Unifier(comptime StoreTypeB: type) type { return error.TypeMismatch; } }, + .num_unbound => { + // Fractional precision wins when unified with decimal integer literals. + self.merge(vars, vars.a.desc.content); + }, .num_compact => |b_compact| { switch (b_compact) { .frac => |b_prec| { diff --git a/src/eval/test_runner.zig b/src/eval/test_runner.zig index 84ae22c987..980d4bcc5c 100644 --- a/src/eval/test_runner.zig +++ b/src/eval/test_runner.zig @@ -118,14 +118,14 @@ const TestSummary = struct { /// A test runner that can evaluate expect expressions in a module. pub const TestRunner = struct { allocator: Allocator, - env: *const ModuleEnv, + env: *ModuleEnv, interpreter: Interpreter, roc_ops: ?RocOps, test_results: std.ArrayList(TestResult), pub fn init( allocator: std.mem.Allocator, - cir: *const ModuleEnv, + cir: *ModuleEnv, ) !TestRunner { return TestRunner{ .allocator = allocator, diff --git a/src/interpreter_shim/main.zig b/src/interpreter_shim/main.zig index 56babecaae..abfe6c59c3 100644 --- a/src/interpreter_shim/main.zig +++ b/src/interpreter_shim/main.zig @@ -203,7 +203,7 @@ fn setupModuleEnv(shm: *SharedMemoryAllocator, roc_ops: *RocOps) ShimError!*Modu /// Create and initialize interpreter with heap-allocated stable objects fn createInterpreter(env_ptr: *ModuleEnv, roc_ops: *RocOps) ShimError!Interpreter { const allocator = std.heap.page_allocator; - var interpreter = eval.Interpreter.init(allocator, env_ptr) catch { + const interpreter = eval.Interpreter.init(allocator, env_ptr) catch { roc_ops.crash("INTERPRETER SHIM: Interpreter initialization failed"); return error.InterpreterSetupFailed; }; diff --git a/src/playground_wasm/main.zig b/src/playground_wasm/main.zig index c064b5c05b..5c92b24772 100644 --- a/src/playground_wasm/main.zig +++ b/src/playground_wasm/main.zig @@ -1344,7 +1344,7 @@ fn writeCanCirResponse(response_buffer: []u8, data: CompilerStageData) ResponseW fn writeEvaluateTestsResponse(response_buffer: []u8, data: CompilerStageData) ResponseWriteError!void { // use arena for test evaluation - var env = data.module_env; + const env = data.module_env; var local_arena = std.heap.ArenaAllocator.init(allocator); defer local_arena.deinit();