Florian’s compiler news, 28 October 2025
- January 13, 2025
This series of blog post aims to give a short weekly glimpse into my (Florian Angeletti) work on the OCaml compiler. This week subject is my personal retrospective on the release of OCaml 5.4.0.
PRs
Stdlib
(breaking change) #13570, #13794: Format, add an out_width function to Format device for approximating unicode width. (Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli, and Gabriel Scherer)
#13569: add a
Format.format_textwhich adds break hints to format literals. (Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli, and Gabriel Scherer)
CLI
- #13764, #13779: add missing “-keywords” flag to ocamldep and ocamlprof (Florian Angeletti, report by Prashanth Mundkur, review by Gabriel Scherer)
OCamldoc
#13877: ocamldoc, add a
-latex-escape-underscoreflag to control the escaping of_underscore in latex references (in order to be able to match odoc behaviour). (Florian Angeletti, review by Gabriel Scherer)#13896, #14098: ocamldoc, do not wrap module description in a paragraph tag inside the table of modules (Florian Angeletti, report by John Whitington, review by Gabriel Scherer)
Error messages
#13702, #13865: Specialized error messages for functors appearing in contexts where non-functors were expected
module A: sig ... end = Set.Make(and the reverse) (Florian Angeletti, report by Jeremy Yallop, review by Gabriel Scherer)#14070: also point to label mismatches in error messages for labelled tuples (Florian Angeletti, review by Gabriel Scherer)
#13788, #13813: Keep the module context in spellchecking hints.
Fun.protactnow promptsDid you mean "Fun.protect?"rather thanDid you mean "protect?". (Florian Angeletti, suggestion by Daniel Bünzli, review by Gabriel Scherer)#13817: align spellchecking hints with the possibly misspelled identifier/ Error: Unbound type constructor “aray” Hint: Did you mean “array”? (Florian Angeletti, suggestion by Daniel Bünzli, review by Gabriel Scherer)
#13563, lighter inline code styling for output without bold support: inline code is no longer printed as “…” to avoid confusion with OCaml strings. (Florian Angeletti, review by Richard Eisenberg)
#13568, composable formatting for warning and alert messages (Florian Angeletti, review by Richard Eisenberg)
#13818: better delimited hints in error message (Florian Angeletti, review by Gabriel Scherer)
Typechecker bug fixes:
#13778, #13811: do not warn for unused type declarations when the type is used in a first-class module type (
module S with type t = int). (Florian Angeletti, report by Nicolás Ojeda Bär, review by Gabriel Scherer)#14135: Fix a rare internal typechecker error when combining recursive modules, polymorphic fields or methods, and constrained type parameters. (Florian Angeletti, review by Gabriel Scherer)
#14214, #14221: fix a confused error message for module inclusions, functor error messages were missing some type equalities potentially leading to nonsensical “type t is not compatible with type t” submessage (Florian Angeletti, report by Basile Clément, review by Gabriel Scherer)
#14108: toplevel, fix a typo in directive type mismatch (Florian Angeletti, review by Gabriel Scherer)
Runtime bug fix
#14101, #14139: define atomic helper types inside
caml/misc.hto improve header compatibility with C++ (Florian Angeletti, report by Kate Deplaix, review by Gabriel Scherer)#14169: runtime, fix cache miss within the stack fragments cache (Florian Angeletti, review by Gabriel Scherer)
Reviews
Standard library:
#13760: Add String.{edit_distance,spellcheck} (Daniel Bünzli, review by wikku, Nicolás Ojeda Bär, Gabriel Scherer and Florian Angeletti)
#13753, #13755: Add Stdlib.Repr: Repr.phys_equal and Repr.compare are more explicit than (==) and
compare. (Kate Deplaix, Thomas Blanc and Léo Andrès, review by Gabriel Scherer, Florian Angeletti, Nicolás Ojeda Bär, Daniel Bünzli and Jeremy Yallop)#13796: Add Uchar.utf_8_decode_length_of_byte and Uchar.max_utf_8_decode_length. (Daniel Bünzli, review by Nicolás Ojeda Bär and Florian Angeletti)
#13768: Add Either.get_left and Either.get_right (T. Kinsart, review by Nicolás Ojeda Bär and Florian Angeletti)
#13310: Add Stdlib.Pair (Victoire Noizet, review by Nicolás Ojeda Bär, Daniel Bünzli, Xavier Van de Woestyne, Jeremy Yallop and Florian Angeletti)
#13620: Avoid copying the string in String.concat, String.sub and String.split_on_char when the full string is returned. (Christophe Raffalli, review by Nicolás Ojeda Bär and Gabriel Scherer and Hugo Heuzard)
Tools:
- #12642, #13536, #14184, #14192: in the toplevel, print shorter paths for constructors and labels when only some modules along their path are open. (Gabriel Scherer, review by Florian Angeletti)
Manual and documentation:
#12452: Add examples to Stdlib.Fun documentation. (Hazem ElMasry, review by Florian Angeletti and Gabriel Scherer)
#13924: Document how to put [@deprecated] on let bindings, constructors, etc in the manual (Valentin Gatien-Baron, review by Florian Angeletti)
Compiler user-interface and warnings:
#13663: Improve the error message when GADT parameter variance cannot be checked. (Stefan Muenzel, review by Gabriel Scherer and Florian Angeletti)
#13646: Improve the error messages when a recursive module type references another recursive module type. (Stefan Muenzel, review by Florian Angeletti and Gabriel Scherer)
#13809: Distinguish
(module M : S)and(module M) : (module S)and change locations of error messages whenSis ill-typed in(module S)(Samuel Vivien, review by Florian Angeletti and Gabriel Scherer)#13814, 13898: Add an
unused-type-declarationwarning when using at as 'awith no other occurences of'a(Samuel Vivien, review by Florian Angeletti, Kate Deplaix)
Internal/compiler-libs changes:
#13302, #14236: Store locations of longidents components (Ulysse Gérard and Jules Aguillon, review by Jules Aguillon and Florian Angeletti)
#13460: introduce a variant of all predefined types (Gabriel Scherer, review by Ulysse Gérard and Florian Angeletti)
#13457, #13537: Annotate alloc/free open/close pairs of functions with compiler attributes for static analysis. (Antonin Décimo, review by Gabriel Scherer and Florian Angeletti)
#13612: Refactor
type_application(Ulysse Gérard, Leo White, review by Antonin Décimo, Gabriel Scherer, Samuel Vivien, Florian Angeletti and Jacques Garrigue)#13744: Refactor in
collect_apply_args(Samuel Vivien, review by Florian Angeletti and Gabriel Scherer)#13820: Add a new option -i-variance to print the variance of every type parameter; bivariance is printed as
+-, and for consistency, parser is modified too to accept+-and-+astype_variance. (Takafumi Saikawa and Jacques Garrigue, review by Florian Angeletti)#13848: Add all paths components to the cmt files indexes (Ulysse Gérard, review by Florian Angeletti)
#13854: Make the parser set loc_ghost more correctly, for
keyword%extensionsyntax (Valentin Gatien-Baron, review by Florian Angeletti)#13856: Add a new indirection in types AST called
packagethat stores the content of aTpackagenode (Samuel Vivien, review by Florian Angeletti)#13866: Modified occurence check that prevents recursive types for it to see the checked type as a graph rather than a tree (Samuel Vivien, report by Didier Remy, review by Florian Angeletti and Jacques Garrigue)
#13884 Correctly index modules in constructors and labels paths (Ulysse Gérard, review by Florian Angeletti)
#13946: refactor the #install_printer code in the debugger and toplevel (Pierre Boutillier, review by Gabriel Scherer and Florian Angeletti)
#13971: Keep generalized structure from patterns when typing
let(Leo White, review by Samuel Vivien and Florian Angeletti)
Build system:
- #13431:
Simplify github action responsible for flagging PRs with the
parsetree-changeslabel and extend it to mention the @ppxlib-dev team. (Nathan Rebours, review by Florian Angeletti)
Bug fixes:
#13957: Allow ‘effect’ as attribute id. (Pieter Goetschalckx, review by Nicolás Ojeda Bär and Florian Angeletti)
(breaking change) #13605: Fix ungenerated constraints when they where impossible due to polyvars issues (Samuel Vivien, review by Florian Angeletti, Richard Eisenberg and Jacques Garrigue)
#13710: Support unicode identifiers in comments. (Pieter Goetschalckx, review by Florian Angeletti and Gabriel Scherer)
#13845: Fix bug in untypeast/pprintast for value bindings with polymorphic type annotations. (Chris Casinghino, review by Florian Angeletti and Gabriel Scherer)
#13172, #13829: Fix a missing check of illegal recursive module-type definitions (Clement Blaudeau, review by Florian Angeletti)
#13541, #13777: Using C++11
thread_localcauses name-mangling issues when linking with flexlink on Cygwin. (Antonin Décimo and David Allsopp, report by Kate Deplaix)#13956 Fix a regression introduced in #13308 triggering wrong unused warnings. (Ulysse Gérard, review by Florian Angeletti)
#14105: Fix a loop in Pprintast that could result in a hang when printing constructor
(::)in isolation. (Ulysse Gérard, review by Nicolás Ojeda Bär and Florian Angeletti)