From eb05d76b11bf09d3ed867772a56f34726c7732b0 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Mon, 18 May 2026 01:57:09 +0100 Subject: [PATCH] fix(main): thread imported type schemes into check_program (#135) check_file discarded the resolve type_ctx and called check_program without ?import_types, so cross-module imported values (e.g. split imported by io.affine via ADR-011 `use string::{...}`) resolved but were 'Unbound variable' at typecheck. Pass ~import_types:type_ctx.name_types in both check_file branches. Completes the ADR-011 cross-module value-import path at the typecheck stage (affects io and every `use prelude::{...}` consumer). Full suite 233/233, zero regression; stdlib 12/19 (io/collections/result now fail deeper at genuine type-level, no green regressed). Refs #128 --- bin/main.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/main.ml b/bin/main.ml index 64b5b440..2acb3964 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -181,11 +181,13 @@ let check_file face json path = (match Affinescript.Resolve.resolve_program_with_loader prog loader with | Error (e, span) -> add (Affinescript.Json_output.of_resolve_error e span) - | Ok (resolve_ctx, _type_ctx) -> + | Ok (resolve_ctx, type_ctx) -> (* Phase B+C: capture symbol table and use-site references. *) symbols_table := Some resolve_ctx.symbols; resolve_refs := List.rev resolve_ctx.references; - (match Affinescript.Typecheck.check_program resolve_ctx.symbols prog with + (match Affinescript.Typecheck.check_program + ~import_types:type_ctx.Affinescript.Typecheck.name_types + resolve_ctx.symbols prog with | Error e -> add (Affinescript.Json_output.of_type_error e) | Ok _ctx -> @@ -229,8 +231,10 @@ let check_file face json path = Format.eprintf "@[Resolution error: %s@]@." (Affinescript.Face.format_resolve_error face e); `Error (false, "Resolution error") - | Ok (resolve_ctx, _type_ctx) -> - (match Affinescript.Typecheck.check_program resolve_ctx.symbols prog with + | Ok (resolve_ctx, type_ctx) -> + (match Affinescript.Typecheck.check_program + ~import_types:type_ctx.Affinescript.Typecheck.name_types + resolve_ctx.symbols prog with | Error e -> Format.eprintf "@[%s@]@." (Affinescript.Face.format_type_error face e);