My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix OCaml 5.4 compatibility across the monorepo

- Rename `effect` variable to `eff` in editor.ml (reserved keyword in 5.4)
- Add `first_crc` cppo-guarded helper for cmi_crcs API difference
(Import_info.t array in oxcaml vs (string * Digest.t option) list in 5.4)
- Remove `source_rendering` from dune-workspace (not in upstream dune/odoc)

All extension packages, tessera, zarr, and odoc now build with both
oxcaml 5.2.0+ox and standard OCaml 5.4.1. The js_top_worker library
compiles on both; linking requires matching merlin-lib.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+25 -16
-1
dune-workspace
··· 17 17 (odoc 18 18 (html_flags --shell jon-shell 19 19 --config x-ocaml.universe=/_opam) 20 - (source_rendering enabled) 21 20 (prefix reference) 22 21 (warnings fatal) 23 22 )))
+1 -6
js_top_worker/bin/jtw.ml
··· 20 20 let cmi_self_crc cmi_path = 21 21 try 22 22 let cmi = Cmi_format.read_cmi (Fpath.to_string cmi_path) in 23 - let crcs = cmi.Cmi_format.cmi_crcs in 24 - if Array.length crcs > 0 then 25 - match Import_info.crc crcs.(0) with 26 - | Some crc -> Some (Digest.to_hex crc) 27 - | None -> None 28 - else None 23 + Js_top_worker.Impl.first_crc cmi.Cmi_format.cmi_crcs 29 24 with _ -> None 30 25 31 26 (** For a list of toplevel module names and the directory containing their
+20 -5
js_top_worker/lib/impl.cppo.ml
··· 68 68 let memo_server_crc module_name crc = 69 69 Hashtbl.replace crc_memo ("server:" ^ module_name) crc 70 70 71 + (** Extract the first CRC from a cmi_crcs field. 72 + The type differs between oxcaml (Import_info.t array) and 73 + standard OCaml 5.4+ ((string * Digest.t option) list). *) 74 + #if defined OXCAML 75 + let first_crc crcs = 76 + if Array.length crcs > 0 then 77 + match Import_info.crc crcs.(0) with 78 + | Some crc -> Some (Digest.to_hex crc) 79 + | None -> None 80 + else None 81 + #else 82 + let first_crc crcs = 83 + match crcs with 84 + | (_, Some crc) :: _ -> Some (Digest.to_hex crc) 85 + | _ -> None 86 + #endif 87 + 71 88 let lookup_binary_crc module_name = 72 89 Hashtbl.find_opt crc_memo ("binary:" ^ module_name) 73 90 ··· 406 423 (try S.create_file ~name:fs_name ~content with _ -> ()); 407 424 (try 408 425 let cmi = Cmi_format.read_cmi fs_name in 409 - let crcs = cmi.Cmi_format.cmi_crcs in 410 - if Array.length crcs > 0 then 411 - match Import_info.crc crcs.(0) with 412 - | Some crc -> memo_server_crc name (Digest.to_hex crc) 413 - | None -> () 426 + (match first_crc cmi.Cmi_format.cmi_crcs with 427 + | Some hex -> memo_server_crc name hex 428 + | None -> ()) 414 429 with _ -> ()) 415 430 | None -> ()) 416 431 dcs.dcs_toplevel_modules;
+4 -4
x-ocaml/src/editor.ml
··· 75 75 76 76 let refresh_messages ed = 77 77 let range_set = build_range_set ed in 78 - let effect = 78 + let eff = 79 79 Code_mirror.State_effect.of_ set_messages_effect 80 80 (Code_mirror.Decoration.Range_set.to_jv range_set) 81 81 in 82 82 let txn = 83 - Jv.obj [| ("effects", effect) |] 83 + Jv.obj [| ("effects", eff) |] 84 84 |> Code_mirror.Editor.View.Transaction.of_jv 85 85 in 86 86 try Code_mirror.Editor.View.dispatch ed.view txn with _ -> () ··· 211 211 ("to", Jv.of_int doc_len); 212 212 ("insert", Jv.of_jstr (Jstr.of_string doc)) |] 213 213 in 214 - let effect = 214 + let eff = 215 215 Code_mirror.State_effect.of_ set_messages_effect 216 216 (Code_mirror.Decoration.Range_set.to_jv 217 217 (Code_mirror.Decoration.Range_set.empty)) 218 218 in 219 219 let txn = 220 - Jv.obj [| ("changes", changes); ("effects", effect) |] 220 + Jv.obj [| ("changes", changes); ("effects", eff) |] 221 221 |> Code_mirror.Editor.View.Transaction.of_jv 222 222 in 223 223 Code_mirror.Editor.View.dispatch t.view txn;