Thicket thicket
ocaml
REPOS 2

Core covers the OCaml compiler and language RFCs.

W46.2026 · 9–15 NovCore

A compiler crash on certain pattern matches is fixed, and a proposal would turn partial-match warnings into hard errors. Several library bugs are also patched, including string functions that returned wrong results with extreme inputs.

Fixes

Pattern-match crash: Writing a total match with redundant or-pattern cases guarded by when used to abort the compiler with a fatal error. The compiler now rejects the code with a normal error message instead. #15184

String edge-case bug: String.take_first, take_last, and drop_last returned the entire string when the count argument was min_int. The clamp is now applied before the subtraction, so these functions return the expected empty result. #15277

Weak reference copy speed: Weak.blit on multi-key ephemerons (weak references that track several keys at once) performed a full cleanup of the destination for every element copied. The cleanup now happens once, removing the quadratic slowdown. #15143

Proposals

[@generative] attribute: A new attribute would prevent the compiler from reusing the same immutable value in multiple places, so == gives a precise, predictable result. This matters for formal verification, where shared values can make equality checks unreliable. #15297

Unboxing for variant types: The existing [@unboxed] attribute currently works only on single-constructor types. This proposal extends it to variant types with multiple constructors via a companion [@shape] attribute, so you can request a compact representation for your own variant types. #15227

Compatibility

Partial matches become errors (proposal): A proposal would promote warning 8 (a pattern match that does not cover all possible inputs) from a warning to a hard compile error in ocamlc and ocamlopt, while the toplevel keeps it as a warning. If adopted, existing code with non-exhaustive matches would need updating before the next release. #15269