Skip to content

Commit eb05d76

Browse files
committed
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
1 parent 6a233b4 commit eb05d76

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

bin/main.ml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,13 @@ let check_file face json path =
181181
(match Affinescript.Resolve.resolve_program_with_loader prog loader with
182182
| Error (e, span) ->
183183
add (Affinescript.Json_output.of_resolve_error e span)
184-
| Ok (resolve_ctx, _type_ctx) ->
184+
| Ok (resolve_ctx, type_ctx) ->
185185
(* Phase B+C: capture symbol table and use-site references. *)
186186
symbols_table := Some resolve_ctx.symbols;
187187
resolve_refs := List.rev resolve_ctx.references;
188-
(match Affinescript.Typecheck.check_program resolve_ctx.symbols prog with
188+
(match Affinescript.Typecheck.check_program
189+
~import_types:type_ctx.Affinescript.Typecheck.name_types
190+
resolve_ctx.symbols prog with
189191
| Error e ->
190192
add (Affinescript.Json_output.of_type_error e)
191193
| Ok _ctx ->
@@ -229,8 +231,10 @@ let check_file face json path =
229231
Format.eprintf "@[<v>Resolution error: %s@]@."
230232
(Affinescript.Face.format_resolve_error face e);
231233
`Error (false, "Resolution error")
232-
| Ok (resolve_ctx, _type_ctx) ->
233-
(match Affinescript.Typecheck.check_program resolve_ctx.symbols prog with
234+
| Ok (resolve_ctx, type_ctx) ->
235+
(match Affinescript.Typecheck.check_program
236+
~import_types:type_ctx.Affinescript.Typecheck.name_types
237+
resolve_ctx.symbols prog with
234238
| Error e ->
235239
Format.eprintf "@[<v>%s@]@."
236240
(Affinescript.Face.format_type_error face e);

0 commit comments

Comments
 (0)