Skip to content

Commit

Permalink
Fix missing topological sort
Browse files Browse the repository at this point in the history
  • Loading branch information
msprotz committed Sep 12, 2024
1 parent b2946d0 commit 1a65dbf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Bundles.ml
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,14 @@ let reassign_monomorphizations (files : Krml.Ast.file list) (config : config) =
f, decls @ reassigned)
files
in

(* Deal with files that did not exist previously. *)
let files = files @ Hashtbl.fold (fun f reassigned acc -> (f, reassigned) :: acc) reassigned [] in

(* A quick topological sort to make sure type declarations come *before*
functions that use them. *)
let files = List.map (fun (f, decls) -> f, topological_sort decls) files in

(* Deal with files that did not exist previously. *)
let files = files @ Hashtbl.fold (fun f reassigned acc -> (f, reassigned) :: acc) reassigned [] in
let c1 = count_decls files in
assert (c0 = c1);
files

0 comments on commit 1a65dbf

Please sign in to comment.