OCaml Changelog

RSS

Official stable release announcements and updates from the OCaml compiler, OCaml infrastructure and the OCaml Platform Tools.

Odoc 3.1.0

We're excited to announce the release of odoc 3.1.0! This release brings several new features, important improvements, and bug fixes to OCaml's documentation generator.

What's New

OCaml 5.4.0 Compatibility

Full support for OCaml 5.4.0 has been added, ensuring odoc stays current with the latest OCaml releases.

New Output Formats and Options

  • Enhanced LaTeX Generator: New command-line arguments --shorten-beyond-depth and --remove-functor-arg-link provide more control over LaTeX output formatting

Key Improvements

Modernized Dependencies

The cmdliner compatibility layer has been removed as it's no longer needed, simplifying the codebase and reducing maintenance overhead.

Updated System Requirements

Support for OCaml versions prior to 4.08 has been dropped, allowing the project to leverage more modern language features and reduce compatibility complexity.

Better Configuration Management

Libraries from packages can now be referenced when added in odoc-config.sexp, improving flexibility in documentation project setup.

Improved LaTeX Output

  • Heading labels now use full paths to improve navigation and reference accuracy
  • Page and anchor separation in LaTeX labels prevents naming collisions

Bug Fixes

This release addresses several important issues:

  • Fixed META file parsing when dependencies are absent
  • Resolved rendering problems on medium screen sizes without global sidebar
  • Corrected occurrence generation for documentation CI systems
  • Ensured hidden pages never receive links, preventing broken references

Getting Started

To install odoc 3.1.0:

opam install odoc

For existing users, upgrade with:

opam upgrade odoc

Contributors

Special thanks to all contributors who made this release possible: @jonludlam, @Octachron, @davesnx, @dbuenzli, @panglesd, and @lukemaurer.

What's Next

We continue to work on expanding odoc's capabilities and improving documentation generation. The development team remains committed to making OCaml documentation more accessible and comprehensive.

Happy documenting!

See full changelog

### Added

Changed

Fixed

We're happy to announce the release of Ppxlib 0.36.1!

See full changelog
  • Fix ppxlib driver's AST to source printer. Our copy of pprintast was not properly updated which resulted in incorrect printing of value bindings' constraints (#585, @NathanReb)

We're pleased to announce the release of OCaml LSP Server 1.23.0!

See full changelog

Features

  • Make inlay-hint for function parameters configurable (#1515)
  • Add custom ocamllsp/jumpToTypedHole to navigate through typed holes (#1516)
  • Add a code-action for combining pattern cases (just relaying on regex) (#1514)
  • Allow (by configuration) shortening of diagnostics (just highlighting the first line) (#1513)
  • Fix yojson_of_t for Nullable_option: serialize None as Null instead of asserting false (#1525 fixes #1524)

Fixes

  • Support for class, class type, method and property for DocumentSymbol query (#1487 fixes #1449)
  • Fix inlay-hint for function parameters (#1515)
  • More precise diagnostics in the event of a failed identifier search (Definition_query) (#1518)
  • Remove ocamlformat application after destruct (that remove some useful parenthesis) (#1519)

Merlin 5.5-503 is now available! This release addresses several long-standing issues with jump-to-definition, occurrences reporting, and inlay hints while adding new utilities for working with typed holes.

Key changes include enhanced locate functionality that can now disambiguate between files with identical names and contents, fixes to occurrences that properly report stale files, and corrected inlay hints on function parameters. The outline feature has been expanded to handle class types and locally defined values, with a new selection field that provides the exact location of symbols. Several jump-to-definition issues have been resolved, and the destruct feature no longer hangs when processing patterns with the cons operator (::).

The merlin library now exposes utilities for manipulating typed holes through Merlin_analysis.Typed_hole, and ocaml-index has improved performance through better granularity in index reading via segmented marshalization. This release also includes fixes for typer assertion failures and cache backtracking issues that were causing crashes in certain scenarios.

See full changelog
  • merlin library
    • Expose utilities to manipulate typed-holes in Merlin_analysis.Typed_hole
      (#1888)
    • locate can now disambiguate between files with identical names and contents
      (#1882)
    • occurrences now reports stale files (#1885)
    • inlay-hints fix inlay hints on function parameters (#1923)
    • Fix issues with ident validation and Lid comparison for occurrences (#1924)
    • Handle class type in outline (#1932)
    • Handle locally defined value in outline (#1936)
    • Fix a typer issue triggering assertions in the short-paths graph (#1935,
      fixes #1913)
    • Downstreamed a typer fix from 5.3.X that would trigger assertions linked
      to scopes bit masks when backtracking the typer cache (#1935)
    • Add a new selection field to outline results that contains the location of
      the symbol itself. (#1942)
    • Fix destruct hanging when printing patterns with (::). (#1944, fixes
      ocaml/ocaml-lsp#1489)
    • Reproduce and fix a handful of jump-to-definition (locate) issues (#1930,
      fixes #1580 and #1588, workaround for #1934)
  • ocaml-index
    • Improve the granularity of index reading by segmenting the marshalization
      of the involved data-structures. (#1889)
  • test suite
    • Add a test case illustrating wrong open order proposed in issue #1900. (#1901)

We're pleased to announce the release of OCaml LSP Server 1.21.0-4.14!

See full changelog

Features

  • Make inlay-hint for function parameters configurable (#1515)

  • Add custom ocamllsp/jumpToTypedHole to navigate through typed holes (#1516)

  • Add a code-action for combining pattern cases (just relaying on regex) (#1514)

  • Allow (by configuration) shortening of diagnostics (just highlighting the first line) (#1513)

  • Fix yojson_of_t for Nullable_option: serialize None as Null instead of asserting false (#1525 fixes #1524)

Fixes

  • Support for class, class type, method and property for DocumentSymbol query (#1487 fixes #1449)

  • Fix inlay-hint for function parameters (#1515)

  • More precise diagnostics in the event of a failed identifier search (Definition_query) (#1518)

  • Remove ocamlformat application after destruct (that remove some useful parenthesis) (#1519)

  • Add a new server option standardHover, that can be used by clients to
    disable the default hover provider. When standardHover = false
    textDocument/hover requests always returns with empty result. (#1416)

We are pleased to announce the release of Merlin 4.19-414!

See full changelog
  • merlin library
    • Expose utilities to manipulate typed-holes in Merlin_analysis.Typed_hole
      (#1888)
    • inlay-hints fix inlay hints on function parameters (#1923)
    • Handle class type in outline (#1932)
    • Handle locally defined value in outline (#1936)
  • vim plugin
    • Added support for search-by-type (#1846)
      This is exposed through the existing :MerlinSearch command, that
      switches between search-by-type and polarity search depending on the
      first character of the query.

Dune 3.19.1

The Dune Team is happy to announce the release of Dune 3.19.1.

This patch release contains a fix reverting some regressions on how dune exec handles processes. It restores the previous behaviour.

See full changelog

Fixed

  • Revert changes in dune exec behaviour introduced in 3.19.0. (#11879, fixes #11870, #11867 and #11881, @Alizter)

Dune 3.19.0

The Dune Team is happy to announce the release of Dune 3.19.0.

This release contains some important fixes along with some improvements for the foreign_library stanza. It introduces support for concurrent builds through the RPC server.

See full changelog

Fixed

  • Fixed a bug that was causing cram tests attached to multiple aliases to be run multiple times. (#11547, @Alizter)

  • Fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA)

  • Fix: Evaluate enabled_if when computing the stubs for stanzas such as foreign_library (#11707, @Alizter, @rgrinberg)

  • Fix $ dune describe pp for libraries in the presence of (include_subdirs unqualified) (#11729, fixes #10999, @rgrinberg)

  • Fix $ dune subst in sub directories of a git repository (#11760, fixes #11045, @Richard-Degenne)

  • Fix a crash involving Path.drop_prefix when using Melange on Windows (#11767, @nojb)

Added

  • Added detection and warning for common typos in package dependency constraints (#11600, fixes #11575, @kemsguy7)

  • Added (extra_objects) field to (foreign_library) stanza with (:include) support. (#11683, @Alizter)

Changed

  • Allow build RPC messages to be handled by dune's RPC server in eager watch mode (#11622, @gridbugs)

  • Allow concurrent build with RPC server (#11712, @gridbugs)

Dune 3.18.2

The Dune Team is happy to announce the release of Dune 3.18.2.

This release contains a bug fix to fix a compatibility issue with ocaml.5.4.0.

See full changelog

Fixed

  • fix compatibility with ocaml.5.4.0 by avoiding shadowing sigwinch (@nojb, #11639)

Dune 3.18.1

The Dune Team is happy to announce the release of Dune 3.18.1!

This release contains a bug fix for pkg-config that prevents it from finding some libraries in specific contexts.

See full changelog

Fixed

  • fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA)

Dune 3.18.0

The Dune Team is happy to announce the release of Dune 3.18.0!

This release contains changes to support the new x-maintenance-intent field by default. It also contains some changes regarding the cache about how it handles file permissions. It introduces a new (format-dune-file ...) stanza with the intention to formalize the dune format-dune-file command as an inside rule. Finally, it includes various bug fixes for Dune.

See full changelog

Fixed

  • Support HaikuOS: don't call execve since it's not allowed if other pthreads have been created. The fact that Haiku can't call execve from other threads than the principal thread of a process (a team in haiku jargon), is a discrepancy to POSIX and hence there is a bug about it. (@Sylvain78, #10953)

  • Fix flag ordering in generated Merlin configurations (#11503, @voodoos, fixes ocaml/merlin#1900, reported by @vouillon)

Added

  • Add (format-dune-file <src> <dst>) action. It provides a replacement to dune format-dune-file command. (#11166, @nojb)

  • Allow the --prefix flag when configuring dune with ocaml configure.ml. This allows to set the prefix just like $ dune install --prefix. (#11172, @rgrinberg)

  • Allow arguments starting with + in preprocessing definitions (starting with (lang dune 3.18)). (@amonteiro, #11234)

  • Support for opam (maintenance_intent ...) in dune-project (#11274, @art-w)

  • Validate opam maintenance_intent (#11308, @art-w)

  • Support not in package dependencies constraints (#11404, @art-w, reported by @hannesm)

Changed

  • Warn when failing to discover root due to reads failing. The previous behavior was to abort. (@KoviRobi, #11173)

  • Use shorter path for inline-tests artifacts. (@hhugo, #11307)

  • Allow dash in dune init project name (#11402, @art-w, reported by @saroupille)

  • On Windows, under heavy load, file delete operations can sometimes fail due to AV programs, etc. Guard against it by retrying the operation up to 30x with a 1s waiting gap (#11437, fixes #11425, @MSoegtropIMC)

  • Cache: we now only store the executable permission bit for files (#11541, fixes #11533, @ElectreAAS)

  • Display negative error codes on Windows in hex which is the more customary way to display NTSTATUS codes (#11504, @MisterDA)

Odoc 3.0.0

We are delighted to announce the release of Odoc 3! This is a big release with loads of new features and bug fixes, and we encourage everyone to install it and try the new features!

This release has been cooking for a long time - it’s been more than a year since odoc 2.4 landed, and a huge amount of work has gone into this. Thanks to the many others who contributed, either by code or by comments: @juloo, @panglesd, @EmileTrotignon, @gpetiot, @trefis, @sabine, @dbuenzli, @yawaramin, and more.

Here is an overview of some major new features:

  • Search by type! Our detective sherlodoc will find your lost value given its type.
  • Odoc 3 features a global sidebar, allowing you to discover all documentation pages
  • The generated documentation include the source code. You can jump from any item in the documentation straight to its rendered source; no matter how much of OCaml’s complex module system you are using.
  • You can now add images to your documentation, as well as video and audio files Hierarchical documentation pages allow you to structure your documentation better
  • Reference items from other packages! With the ability to use cross-package links in your documentation, the generated documentation is now truly connected.
  • The build dependencies are friendlier with incremental build systems, allowing better shared build caches

With this release we’re including a driver that makes use of all the exciting new features of odoc. This driver has been used to create the docs site for the various odoc tools. However, Dune does not yet support odoc 3 since the Dune rules for running odoc via Dune need to be rewritten to reflect the odoc's new CLI and the new incremental build related capabilities odoc 3 brings.

Until Dune supports odoc 3, here is how to get started:

$ opam install odoc-driver # will install odoc 3
$ odoc_driver odoc odoc-parser odoc-driver odoc-md sherlodoc --remap

and point your browser at _html/index.html. This example shows odoc_driver creating the docs for exactly the 5 packages specified. While doing so, it will remap links to other packages to instead link to their documentation page hosted on ocaml.org (see "Remapping dependencies" in the odoc documentation).

If you try the above command, you'll note something interesting, and hopefully this will encourage you to run odoc_driver on your own packages before you release them, as then you'll be able to avoid slightly embarrassing post-release fixes like this one 😬

See full changelog

Added

  • Add png, pdf and jpeg image support to the latex backend by Octachron · Pull Request #1297 · ocaml/odoc · GitHub
  • Add header field to the json output by panglesd · Pull Request #1314 · ocaml/odoc · GitHub
  • Extract code blocks by name by panglesd · Pull Request #1326 · ocaml/odoc · GitHub

Changed

  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Disable warnings coming from linking implementations by jonludlam · Pull Request #1319 · ocaml/odoc · GitHub
  • Driver compile warnings by jonludlam · Pull Request #1323 · ocaml/odoc · GitHub
  • Fix "box model" for code blocks by panglesd · Pull Request #1317 · ocaml/odoc · GitHub
  • Store raw content of code blocks in parser's AST by panglesd · Pull Request #1325 · ocaml/odoc · GitHub

Fixed

  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Don't backtrace on invalid input in compile-deps by jonludlam · Pull Request #1313 · ocaml/odoc · GitHub
  • Fix indentation bug with verbatim in tags by jonludlam · Pull Request #1312 · ocaml/odoc · GitHub
  • Driver: Check for missing/unknown opam packages by jonludlam · Pull Request #1311 · ocaml/odoc · GitHub
  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Further fixes for virtual libraries by jonludlam · Pull Request #1309 · ocaml/odoc · GitHub
  • Fix issue #610 - odoc html-fragment not producing headings correctly by jonludlam · Pull Request #1306 · ocaml/odoc · GitHub
  • Fix classify when there are archives sharing modules by jonludlam · Pull Request #1310 · ocaml/odoc · GitHub

We are happy to announce the release of ppxlib.0.36.0!

With this release, the internal AST that ppxlib targets has been bumped to the AST of OCaml 5.2. Ppx authors can now use features from OCaml 5.2. Ppxlib still supports any OCaml compiler after and including 4.08.0.

Many ppxes will be broken by changes made to the representation of functions. Authors are encouraged to read the upgrade guide.

See full changelog
  • Change Location.none to match the compiler's Location.none as of OCaml 4.08. This fixes a bug in loc_of_attribute (#540, @ncik-roberts, @patricoferris)

  • Bump ppxlib's AST to 5.2.0 (#514, @patricoferris)

  • Add the [@@@expand_inline] transformation and support for floating attribute context free transformations. (#560, @jaymody)

  • Add a -raise-embedded-errors flag to the driver. Setting this flag raises the first ocaml.error embedded in the final AST.

  • Export Ast_pattern.fail. (#563, @ceastlund)

  • Make Ast_traverse.sexp_of more concise, and add a test. (#561, @ceastlund)

We are happy to announce the release of ppxlib.0.35.0!

The main feature of this release is improved support for OCaml 5.3, allowing ppx users to have ppx rewriters operate on files with the new effect syntax.

Note that ppx-es and the effect syntax can cohabit but it is possible that ppx rewriters will error out if they encounter effect syntax node in their extension's payload or in the items they generate code from.

This feature also comes with a new --use-compiler-pp driver flag. This flag is required to preserve the effect syntax when the ppxlib driver outputs source code instead of marshalled AST. Note that the vast majority of users won't need to use this flag but it can come in handy in some more advanced use cases.

See full changelog
  • Allow use of effect syntax in preprocessed files without causing migration failures. (#552, @hhugo, @NathanReb)

  • Remove support for compilers older than 4.08 (#556, @NathanReb)

  • Add a --use-compiler-pp flag to the standalone driver. This flag can be set when the driver outputs source code to make it use the compiler's Pprintast instead of ppxlib's. (#555, @NathanReb)

Dune-release 2.1.0 has been released!

With this update,

  • A new commanddune-release delegate-info version has been added, which shows the current version of the package, as inferred by dune-release.
  • The dev-repo field in the .opam file can now be overridden using the --dev-repo flag on the commands dune-release and dune-release publish.
  • A bug related to decoding GitHub URLs has been fixed (FIXME:explain context and what's working now that wasn't before)
  • dune-release no longer publishes docs to github pages. This choice has been made because, as a consequence of publishing to opam-repository, the package documentation is built and served by ocaml.org/packages.
  • dune-release now works with the experimental package management feature from Dune Developer Preview.
See full changelog

Added

  • Add dune-release delegate-info version to show the current version as infered by the tool (#495, @samoht)
  • Add --dev-repo to dune-release and dune-release publish to overwrite the dev-repo field specified in the opam file (#494, @samoht)

Changed

  • Use the 'user' option as the fork owner, only attempt to decode the remote URL if the user option is not set. (#480, @Julow)

Fixed

  • Make dune-release not fail in the presence of ~/.dune/bin/dune (which is present when using dune package management)

Removed

  • dune-release no longer publishes docs to github pages. Instead, we rely on the docs published under ocaml.org/packages (#499 #500, @v-gb @samoht)

Dune 3.17.2

The Dune team is happy to announce the release of Dune 3.17.2!

This patch release includes some bug fixes. It brings some fixes for Melange and Wasm_of_ocaml. It also fixes a bug that prevents the experimental feature, package management, to build with ocaml.5.3.0.

See full changelog

Fixed

  • Fix a crash in the Melange rules that would prevent compiling public library implementations of virtual libraries. (@anmonteiro, #11248)
  • Pass melange.emit's compile_flags to the JS emission phase. (@anmonteiro, #11252)
  • Disallow private implementations of public virtual libs in melange mode. (@anmonteiro, #11253)
  • Wasm_of_ocaml: fix the execution of tests in a sandbox. (#11304, @vouillon)

We're happy to announce the release of Merlin 5.4.1-503!

See full changelog
  • ocaml-index
    • Bump magic number after index file format change (#1886)

We're pleased to announce the release of OCaml LSP Server 1.22.0, which enables experimental project-wide renaming of identifiers!

See full changelog

Features

  • Enable experimental project-wide renaming of identifiers (#1431)

Merlin 5.4-503 is now available with support for OCaml 5.3. This release leverages new features in OCaml 5.3 to improve locate behavior, resolving issues where Merlin previously confused unique identifiers from interfaces and implementations. The indexer has been optimized to perform fewer merges, and initial support for project-wide renaming has been added, allowing occurrences to return all usages of related definitions across a project.

The Vim plugin receives an enhancement with search-by-type functionality, accessible through the existing :MerlinSearch command. The command now automatically switches between search-by-type and polarity search based on the first character of the query.

See full changelog
  • merlin binary
    • Support for OCaml 5.3
    • Use new 5.3 features to improve locate behavior in some cases. Merlin no
      longer confuses uids from interfaces and implementations. (#1857)
    • Perform less merges in the indexer (#1881)
    • Add initial support for project-wide renaming: occurrences can now return
      all usages of all related definitions. (#1877)
  • vim plugin
    • Added support for search-by-type (#1846)
      This is exposed through the existing :MerlinSearch command, that
      switches between search-by-type and polarity search depending on the
      first character of the query.

OCaml LSP Server version 1.21.0 is now available. This release introduces a new server option called standardHover that allows clients to disable the default hover provider functionality.

See full changelog

Features

  • Add a new server option standardHover, that can be used by clients to
    disable the default hover provider. When standardHover = false
    textDocument/hover requests always returns with empty result. (#1416)

We’re happy to announce that we just released ppxlib.0.34.0.

The full patch notes are available on the release page over here.

The main features are OCaml 5.3 compatibility, new AST pretty-printing utilities and the ppxlib-tools package, support for [@@deriving ...] on class types and the addition of missing Pprintast entry points.

Changes summary

5.3 compatibility

ppxlib.0.34.0 is the first official ppxlib release that’s compatible with the new 5.3 compiler.

The ppxlib driver now also comes with a -keywords CLI option, similar to the compiler’s that allow you to compile and preprocess with the 5.3 compiler code that uses effect as an identifier. This is pretty niche but it’s there should you need it.

Please note that means you can use ppx-es with a 5.3 compiler but not that ppx-es can consume/produce 5.3 language features. We’re currently working on a fix allowing you to use the effect syntax in files that require preprocessing as it’s not possible with 0.34.0. The fix should be released in the next few days as 0.34.1.

AST pretty-printing

We added a new Pp_ast module that allows you to pretty print AST fragments.

The only way ppxlib would print ASTs before were as S-expressions. In practice we found that it was not always helpful and wanted a more readable and human friendly way of displaying the AST.

The default output of those printer is a simplified version of the AST to keep things clear and avoid cluttering the output with information that is not always useful. For example, if you run Ppxlib.Pp_ast.Default.expression on the AST for x + 2, you’ll get the following:

Pexp_apply
  ( Pexp_ident (Lident "+")
  , [ ( Nolabel, Pexp_ident (Lident "x"))
    ; ( Nolabel, Pexp_constant (Pconst_integer ( "2", None)))
    ]
  )

The alert reader will note that there are no locations or attributes and that the expression record layer is omitted here.

You can of course configure the printer to display more information if you need to.

We’ve been using these new printers internally to debug migration code and they have been a huge help so we hope they will make working with ppxlib easier for you too.

In addition to this new module, we also added a command line utility called ppxlib-pp-ast to pretty print ASTs from source files, source code fragments or even marshalled AST files. It is very similar to the old ppx_tools’s dumpast.

Note that it will print ppxlib’s internal AST after it’s been migrated from the installed compiler’s version. This is something that we could not simply achieve with OCaml’s own -dparsetree.

This should be a useful tool for debugging ppx related bugs or learning about the AST and we hope ppx authors and users will like it.

Other changes

As mentioned above, we also added some missing Pprintast* entries such as binding, longident and payload.

It is now possible to use [@@deriving ...] on class type declarations and therefore to write derivers for class types.

*: To the confused readers: Pprintast is entirely different from Pp_ast mentioned above as it prints the source code corresponding to a given AST.

Special thanks

We wanted to thank our external contributors for this release: @hhugo, @nojb and @dra27 for their help on the 5.3 compat and @mattiasdrp for bringing the Pprintast module up to speed.

Special thanks as well to @pedrobslisboa who started integrating their excellent ppx-by-example into ppxlib’s documentation.

Finally, I’d also like to thank the OCaml Software Foundation who’s been funding all my work on ppxlib and made this release possible!

Happy preprocessing to you all!

See full changelog
  • Add initial OCaml 5.3 support (#487, @NathanReb, @hhugo, @nojb)

  • Initialise OCaml 5.3's lexer with the keywords setting from OCAMLPARAM or the new -keywords driver's CLI option to allow the standalone ppx driver to process old packages using effect as an identifier (#535, @dra27, @NathanReb)

  • Add Pprintast.binding, longident and payload (#542, @mattiasdrp)

  • Fix deriving_inline round-trip check so that it works with 5.01 <-> 5.02 migrations (#519, @NathanReb)

  • Add ppxlib's AST pretty-printing utilities in Ppxlib.Pp_ast and a ppxlib-pp-ast executable in a new separate ppxlib-tools package (#517, #525, #537, @NathanReb)

  • Change -dparsetree from a sexp output to a pretty printed AST, closer to what the compiler's -dparsetree is. (#530, @NathanReb)

  • Add Parsetree documentation comments to Ast_builder functions (#518, @patricoferris)

  • Support class type declarations in derivers with the new, optional arguments {str,sig}_class_type_decl in Deriving.add (#538, @patricoferris)

We have the pleasure of announcing the release of OCaml version 5.3.0. dedicated to the memory of John William Mauchly and Paul Verlaine on the anniversary of their death.

De la musique avant toute chose, Et pour cela préfère l’Impair

(Music first and foremost of all! Choose your measure of odd not even)

Some of the highlights in OCaml 5.3.0 are:

  • Syntax for deep effect handlers

    There is now a dedicated syntax for installing deep effect handler

    match f () with
    | x -> x
    | effect Random_float, k -> Effect.Deep.continue k (Random.float 1.0)
    

    This new syntax adds a new effect keyword, which may break existing code. To improve backward compatibility, this new keyword can be disabled with the new -keywords flags if needed for backward compatibility.

  • Restored MSVC port

    It is now possible to use the MSVC toolchain on Windows, restoring the last missing port from OCaml 4 (except for the native compiler support for 32-bit architectures which is not planned)

  • Re-introduced statistical memory profiling (statmemprof)

    The submodule Gc.memprof is restored with a slightly different API. This submodule can be used to monitor memory allocation statistics inside a program. In OCaml 5, each domain can be monitored independently while child domains inherit the parent domain profiling profile (if there is one active).

  • utf-8 encoded Unicode source files and modest support of Unicode identifiers

    type saison = Hiver | Été | Printemps | Automne
    

    The OCaml lexer has been extended to support a modest subset of Unicode characters in identifiers. This is mostly intended for pedagogical use. This extended support requires source files to be utf-8 encoded Unicode text.

  • More space-efficient implementation of Dynarray

    The internal implementation of Dynarray now uses an unboxed representation which avoids the need of storing items wrapped in a Some x block and thus saves some spaces and indirections.

  • Improved metadata on the pairs of declarations and definitions for merlin.

    The metadata stored inside cmt files has been improved to better distinguish the provenance of identifiers (previous versions could confuse an interface and implementation identifier). Similarly, the metadata now tracks more precisely the association between declarations and definitions. For instance, in

    module X = struct let x = 0 end
    module M: sig
      val x: int
    end = struct
      let x = 1
      include X
    end
    

    Merlin can now determine that the definition of the M.x value lies inside the module X.

And a lot of incremental changes:

  • Around 20 new functions in the standard library (in the Domain, Dynarray Format, List, Queue, Sys, and Uchar modules).
  • Many fixes and improvements in the runtime
  • Improved error messages for first-class modules, functors, labelled arguments, and type clashes.
  • Numerous bug fixes

Please report any unexpected behaviours on the OCaml issue tracker and post any questions or comments you might have on our discussion forums.

The full list of changes can be found in the full changelog.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 5.3.0

The source code for the release is also directly available on:

Fine-Tuned Compiler Configuration

If you want to tweak the configuration of the compiler, you can switch to the option variant with:

opam update
opam switch create <switch_name> ocaml-variants.5.3.0+options <option_list>

where <option_list> is a space separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.3.0+flambda+nffa ocaml-variants.5.3.0+options ocaml-option-flambda ocaml-option-no-flat-float-array
See full changelog

(Changes that can break existing programs are marked with a "*")

Restored backend:

  • #12954: Restore the MSVC port (David Allsopp, Antonin Décimo, Samuel Hym, and Miod Vallat, review by Nicolás Ojeda Bär)

  • #13093: Allow building the MSVC port with clang-cl. (Antonin Décimo, review by Nicolás Ojeda Bär, Samuel Hym, David Allsopp and Sébastien Hinderer)

Language features:

  • #12309, #13158: Add syntax support for deep effect handlers (Leo White, Tom Kelly, Anil Madhavapeddy, KC Sivaramakrishnan, Xavier Leroy and Florian Angeletti, review by the same, Hugo Heuzard, and Ulysse Gérard)

  • #11736, #12664, #13628: Support utf-8 encoded source files and latin-9 compatible identifiers. (Xavier Leroy and Florian Angeletti, review by Daniel Bünzli and Jules Aguillon)

  • #12828, #13283: Add short syntax for dependent functor types (X:A) -> ... (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer)

Type system

  • #11891, #12507: Allow to name new locally abstract types in constructor type annotations. (Jacques Garrigue, report and review by Gabriel Scherer and Florian Angeletti)

Runtime system:

  • #11911, #12923: Multicore statistical memory profiling. This restores a notable OCaml 4 feature that was missing in OCaml 5. (Nick Barnes, review by Stephen Dolan, Jacques-Henri Jourdan and Guillaume Munch-Maccagnoni).

  • #13419: Fix memory bugs in runtime events system. (B. Szilvasy and Nick Barnes, review by Miod Vallat, Nick Barnes, Tim McGilchrist, and Gabriel Scherer)

  • #13364: Emit major slice counters in the runtime events. (KC Sivaramakrishnan and Sadiq Jaffer, review by Gabriel Scherer)

  • #13382: Add more documentation for Runtime_events types (Sadiq Jaffer, review by Tim McGilchrist, Miod Vallat and KC Sivaramakrishnan)

  • #13370: Fix a low-probability crash when calling Gc.counters. (Demi Marie Obenour, review by Gabriel Scherer)

  • #13272: Allow maximum number of domains to be specified as a OCAMLRUNPARAM parameter. (KC Sivaramakrishnan, review by Guillaume Munch-Maccagnoni, Miod Vallat, Gabriel Scherer, David Allsopp, request by Zachary Yedidia).

  • #12579: OS-based Synchronisation for Stop-the-World Sections (B. Szilvasy, review by Miod Vallat, Nick Barnes, Olivier Nicole, Gabriel Scherer and Damien Doligez)

  • #12789: Restore caml_unregister_frametable from OCaml 4 (Frédéric Recoules, review by Gabriel Scherer)

  • #13003: new, more consistent names for array-creation C functions (Gabriel Scherer, review by Olivier Nicole)

  • #13013: introduce a caml_result type to supersede the use of 'encoded exception values' in the FFI. (Gabriel Scherer, review by Damien Doligez, Guillaume Munch-Maccagnoni and Xavier Leroy, suggested by Guillaume Munch-Maccagnoni)

  • #12407, #13226: Resource-handling improvements: add exception-returning variants for all exception-raising functions in caml/fail.h, for the purpose of cleaning-up state and resources before raising. (Guillaume Munch-Maccagnoni, review by Damien Doligez, Xavier Leroy and Gabriel Scherer)

  • #13086: Avoid spurious major GC slices. (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer and Stephen Dolan)

  • #11779, #13117: Improve logic for fiber stack alignment. (Miod Vallat, report by Damien Doligez, review by Gabriel Scherer)

  • #12839: Remove ATOMIC_UINTNAT_INIT from camlatomic.h (as part of a larger cleanup of camlatomic.h) (David Allsopp, review by Antonin Décimo, Sébastien Hinderer, Samuel Hym, Guillaume Munch-Maccagnoni and Miod Vallat)

  • #13163: Enable frame pointers on macOS x86_64 (Tim McGilchrist, review by Sébastien Hinderer and Fabrice Buoro)

  • #12951: Constify constructors and flags tables in C code (take 2). Now these tables will go in the readonly segment, where they belong. (Antonin Décimo, review by David Allsopp)

  • #10696: Introduce __has_attribute and __has_c_attributes in <caml/misc.h> to test the support of specific attributes in C code. Introduce fallthrough as a wrapper around the fallthrough attribute. (Antonin Décimo, review by Nicolás Ojeda Bär, Xavier Leroy, and Gabriel Scherer)

  • #13083: Use macros from limits.h to avoid signed-integer wrap-around. Introduce CAML_{U,}INTNAT_{MIN,MAX} macros to expose {u,}intnat limits. (Antonin Décimo, review by Nick Barnes, Xavier Leroy, Gabriel Scherer, and Miod Vallat)

  • #13239: Check whether the compiler supports the labels as values extension to enable threaded code interpretation. (Antonin Décimo, review by Miod Vallat)

  • #13238: Enable software prefetching on x86 and x86_64 when building with MSVC or clang-cl. (Antonin Décimo, review by Miod Vallat)

  • #13241, #13261, #13271: Add CFI_SIGNAL_FRAME to ARM64 and RiscV runtimes, for the purpose of displaying backtraces correctly in GDB. (Tim McGilchrist, review by Miod Vallat, Gabriel Scherer and KC Sivaramakrishnan)

  • #13139: Simplify CAMLalign to always use C23/C++11 alignas or C11 _Alignas. Ensures that stat data is always aligned to the best boundary. (Antonin Décimo, review by Miod Vallat and Xavier Leroy)

  • #13280: Check for support of compiler attributes. Allows using compiler attributes with clang-cl. (Antonin Décimo, review by Miod Vallat)

  • #13243: Enable C compiler warnings internally when building with clang-cl or MSVC. Provide fixes too. (Antonin Décimo, review by Miod Vallat and Xavier Leroy)

  • #13242: Define and use unreachable and trap annotation, and clean-up some runtime assertions. (Antonin Décimo, review by Miod Vallat, Gabriel Scherer, and David Allsopp)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13407: Add Runtime_events.EV_EMPTY_MINOR (Thomas Leonard)

  • #13522: Confirm runtime events ring is still active after callback. (KC Sivaramakrishnan, review by Sadiq Jaffer and Miod Vallat)

  • #13529: Do not write to event ring after going out of stw participant set. (KC Sivaramakrishnan, review by Sadiq Jaffer)

Code generation and optimizations:

  • #13014: Enable compile-time option -function-sections on all previously unsupported native backends (POWER, riscv64 and s390x) (Miod Vallat, review by Nicolás Ojeda Bär)

  • #7241, #12555, #13076, #13138, #13338, #13152, #13153, #13154: fix a soundness bug in the pattern-matching compiler when side-effects mutate the scrutinee during matching. (Gabriel Scherer, review by Nick Roberts)

  • #13341: a warning when the pattern-matching compiler pessimizes code because side-effects may mutate the scrutinee during matching. (This warning is disabled by default, as this rarely happens and its performance impact is typically not noticeable.) (Gabriel Scherer, review by Nick Roberts, Florian Angeletti and David Allsopp)

  • #13179: Fix evaluation of toplevel lets in classes containing local opens (Vincent Laviron, review by Hugo Heuzard, Nathanaëlle Courant and Gabriel Scherer)

  • #13543: Remove some String-Bytes conversion from the stdlib to behave better with js_of_ocaml (Hugo Heuzard, review by Gabriel Scherer)

Standard library:

  • #12885: move Dynarray to an unboxed representation (Gabriel Scherer, suggestions by Vincent Laviron, review by Olivier Nicole and Simon Cruanes, Yann Leray, Alain Frisch)

  • #12884: Add Queue.drop (Léo Andrès, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #13168: In Array.shuffle, clarify the code that validates the result of the user-supplied function rand, and improve the error message that is produced when this result is invalid. (François Pottier, review by Florian Angeletti, Daniel Bünzli and Gabriel Scherer)

  • #12133: Expose support for printing substrings in Format (Florian Angeletti, review by Daniel Bünzli, Gabriel Scherer and Nicolás Ojeda Bär)

  • #12869: Add List.take, List.drop, List.take_while and List.drop_while (Kate Deplaix and Oscar Butler-Aldridge, review by Nicolás Ojeda Bär, Craig Ferguson and Gabriel Scherer)

  • #13047: Add Sys.poll_actions to (only) run pending runtime actions. (Nick Barnes, review by Gabriel Scherer, Guillaume Munch-Maccagnoni, and Vincent Laviron)

  • #13144: Dynarray.{equal, compare} (Gabriel Scherer, review by Jeremy Yallop, Daniel Bünzli and Olivier Nicole, request by Olivier Nicole)

  • #13171: expose Domain.self_index : unit -> int (a somewhat-dense indexing of currently-running domains) for advanced use-cases of domain-indexed concurrent data structures. (Gabriel Scherer, review by KC Sivaramakrishnan, Miod Vallat and Nicolás Ojeda Bär, report by Vesa Karvonen)

  • #13197: Dynarray.blit, which allows to extend the destination dynarray (0 <= dst_pos <= dst_length). (Gabriel Scherer, report by Hazem Elmasry, review by Olivier Nicole, Hazem Elmasry and Nicolás Ojeda Bär)

  • (breaking change) #13240: Add Uchar.seeded_hash, Change Uchar.hash implementation. Previously, Uchar.hash was aliased to Uchar.to_int. If you need that behavior, change your module instantiation from eg module HT = Hashtbl.Make(Uchar) to
      module HT = Hashtbl.Make(struct
        ...
        let hash = Uchar.to_int
      end)
    
    If the current implementation is desired, and you have a hashtable module HT (produced with the Make functor) in persistent storage, use HT.rebuild to ensure it doesn't break when reading from or writing to buckets. (Hazem ElMasry, review by Gabriel Scherer and Nicolás Ojeda Bär)
  • #13318: Fix regression in GC alarms, and fix them for flambda. (Guillaume Munch-Maccagnoni, report by Benjamin Monate, review by Vincent Laviron and Gabriel Scherer)

  • #13296: Add mem, memq, find_opt, find_index, find_map and find_mapi to Dynarray. (Jake H, review by Gabriel Scherer and Florian Angeletti)

Other libraries:

  • #11996: release the dependency of dynlink on compilerlibs. (Sébastien Hinderer and Stephen Dolan, review by Damien Doligez and Hugo Heuzard)

  • #13326: Implement Unix.O_APPEND on windows. (Romain Beauxis, review by Miod Vallat, Gabriel Scherer and Antonin Décimo)

Tools:

  • #11716: ocamllex: mismatched parentheses and curly brackets are now caught by ocamllex, instead of causing invalid OCaml code to be generated. (Demi Marie Obenour, review by Damien Doligez and Xavier Leroy)

  • #12904: Run the testsuite with ThreadSanitizer on a PR when label run-thread-sanitizer is added (Olivier Nicole, suggested by Sébastien Hinderer and David Allsopp, review by Gabriel Scherer)

  • (breaking change) #13114: Support ocamldebug remote debugging over IPv6 on all platforms, and over Unix domain sockets on Windows. (Antonin Décimo, review by Gabriel Scherer and Miod Vallat)
  • #13136: Rewrite GDB extensions and macros in debugger-agnostic Python, and add LLDB support for them. (Nick Barnes, review by Tim McGilchrist and Gabriel Scherer)

Toplevel:

  • #12891: Improved styling for initial prompt (Florian Angeletti, review by Gabriel Scherer)

  • #13053: Improved display of builtin types such as _ list when aliased. (Samuel Vivien, review by Florian Angeletti)

Manual and documentation:

  • #13370: Document that that temporary variables holding GCd pointers must not be live across a GC. (Demi Marie Obenour)

  • #12298: Manual: emphasize that Bigarray.int refers to an OCaml integer, which does not match the C int type. (Edwin Török, review by Florian Angeletti)

  • #12868: Manual: simplify style colours of the post-processed manual and API HTML pages, and fix the search button icon (Yawar Amin, review by Simon Grondin, Gabriel Scherer, and Florian Angeletti)

  • #12949: document OCaml release cycles and version strings in release-info/introduction.md. (Florian Angeletti, review by Fabrice Buoro, Kate Deplaix, Damien Doligez, and Gabriel Scherer)

  • #12976: Manual: use webman//*.html and webman//api/ for OCaml.org HTML manual generation (Shakthi Kannan, review by Hannes Mehnert, and Florian Angeletti)

  • #13045: Emphasize caution about behaviour of custom block finalizers. (Nick Barnes)

  • #13216: document the new caml_result type in the FFI chapter of the manual. (Gabriel Scherer, review by Miod Vallat, Daniel Bünzli, Nick Barnes, Guillaume Munch-Maccagnoni and Antonin Décimo)

  • #13287: stdlib/sys.mli: Update documentation on Sys.opaque_identity following #9412. (Matt Walker, review by Guillaume Munch-Maccagnoni and Vincent Laviron)

  • #13295: Use syntax for deep effect handlers in the effect handlers manual page. (KC Sivaramakrishnan, review by Anil Madhavapeddy, Florian Angeletti and Miod Vallat)

  • #13424: Fix Gc.quick_stat documentation to clarify that returned fields live_words, live_blocks, free_words, and fragments are not zero. (Jan Midtgaard, review by Damien Doligez and KC Sivaramakrishnan)

  • #13440: Update documentation of Gc.{control,get,set} to reflect fields not currently supported on OCaml 5. (Jan Midtgaard, review by Gabriel Scherer)

  • #13469, #13474, #13535: Document that [Hashtbl.create n] creates a hash table with a default minimal size, even if [n] is very small or negative. (Antonin Décimo, Nick Bares, report by Nikolaus Huber and Jan Midtgaard, review by Florian Angeletti, Anil Madhavapeddy, Gabriel Scherer, and Miod Vallat)

  • #13666: Rewrite parts of the example code around nested lists in Chapter 6 (Polymorphism and its limitations -> Polymorphic recursion) giving the "depth" function [in the non-polymorphically-recursive part of the example] a much more sensible behavior; also fix a typo and some formatting. (Frank Steffahn, review by Florian Angeletti)

  • #13668: Document the basic support for unicode identifiers and the switch to UTF-8 encoded Unicode text for OCaml source file (Florian Angeletti, review by Nicolás Ojeda Bär and Daniel Bünzli)

Compiler user-interface and warnings:

  • (breaking change) #12084, #13669, #13673: Check link order when creating archive and when using ocamlopt. (Hugo Heuzard, review by Stefan Muenzel and Sébastien Hinderer)
  • #12980: Explain type mismatch involving first-class modules by including the module level error message (Florian Angeletti, review by Vincent Laviron)

  • #12985, #12988: Better error messages for partially applied functors. (Florian Angeletti, report by Arthur Wendling, review by Gabriel Scherer)

  • #13034, #13260: Better error messages for mismatched function labels (Florian Angeletti, report by Daniel Bünzli, review by Gabriel Scherer and Samuel Vivien)

  • #13051: Add a "Syntax error" to error messages for invalid package signatures. (Samuel Vivien, review by Gabriel Scherer)

  • #13099: Fix erroneous loading of cmis for some module type errors. (Nick Roberts, review by Florian Angeletti)

  • #13151, name conflicts explanation as a footnote (Florian Angeletti, review by Gabriel Scherer)

  • #13228: Re-export Cmt2annot.{iterator,binary_part} which had become hidden since #11288 and broke ocamlbrowser. (David Allsopp, report by Jacques Garrigue, review by Sébastien Hinderer)

  • #13251: Register printer for errors in Emitaux (Vincent Laviron, review by Miod Vallat and Florian Angeletti)

  • #13255: Re-enable warning 34 for unused locally abstract types (Nick Roberts, review by Chris Casinghino and Florian Angeletti)

  • #12182: Improve the type clash error message. For example, this message: This expression has type ... is changed into: The constant "42" has type ... (Jules Aguillon, review by Gabriel Scherer and Florian Angeletti)

  • #13471: add -keywords <version?+list> flag to define the list of keywords recognized by the lexer, for instance -keywords 5.2 disable the effect keyword. (Florian Angeletti, review by Gabriel Scherer)

Internal/compiler-libs changes:

  • #13286: Distinguish unique identifiers Shape.Uid.t according to their provenance: either an implementation or an interface. (Ulysse Gérard, review by Florian Angeletti and Leo White)

  • #13308: keep track of relations between declaration in the cmt files. This is useful information for external tools for navigation and analysis purposis. (Ulysse Gérard, Florian Angeletti, review by Florian Angeletti and Gabriel Scherer)

  • #11129, #11148: enforce that ppxs do not produce parsetrees with an empty list of universally quantified type variables (. int -> int instead of 'a . int -> int') (Florian Angeletti, report by Simmo Saan, review by Gabriel Scherer)

  • #12534: document and refactor Matching.mk_failaction_pos (Gabriel Scherer, review by Vincent Laviron and Nick Roberts)

  • #13076: change the handling of Match_failure exits in the pattern-matching compiler, to prepare for a complete fix for #7241 (Gabriel Scherer, review by Thomas Refis and Nick Roberts)

  • #12896: Simplify the compilation of custom bytecode runtimes by explicitly compiling the primitives file before calling the linker. Tidy-up both the generating code and the output itself for C code being generated by the bytecode linker in -custom and -output-* modes. (David Allsopp, Antonin Décimo and Samuel Hym, review by Vincent Laviron)

  • #12932: Remove useless code in Typecore.type_label_exp (was a fix for #4862) (Jacques Garrigue, review by Gabriel Scherer)

  • #12943: Make transient_expr.scope a bitfield, and use it to store marks. Marks are automatically allocated, and removed when leaving their scope. Falls back to using TransientTypeSet when marks are exhausted. (Jacques Garrigue and Takafumi Saikawa, review by Basile Clément)

  • #12946: Make generalization automatic when leaving scope. As a result, the Ctype.generalize* and Ctype.correct_levels functions were removed. The latter is now called Ctype.duplicate_type. (Jacques Garrigue and Takafumi Saikawa, review by Richard Eisenberg)

  • #12968: Attach location to constants in the parsetree (Jules Aguillon, review by Gabriel Scherer)

  • #12959, #13055: Avoid an internal error on recursive module type inconsistency (Florian Angeletti, review by Jacques Garrigue and Gabriel Scherer)

  • #13049: graphical debugging printer for types (Florian Angeletti, review by Gabriel Scherer)

  • #13074, #13082, #13084: refactoring in the pattern-matching compiler (Gabriel Scherer, review by Thomas Refis, Vincent Laviron and Nick Roberts)

  • #13067: rework volatile memory access rules under TSan to consider properly aligned smaller-than-register read operations as atomic, which gets rid of false positives on s390x (Miod Vallat, review by Fabien Buoro)

  • #13162: Use quoted strings to clarify code being generated. (Antonin Décimo, review by Miod Vallat and Gabriel Scherer)

  • #13015: Emit floating-point literals in .rodata section on ELF arm64 platforms (Linux, *BSD). (Miod Vallat, review by Nicolás Ojeda Bär)

  • #13169, #13311: Introduce a document data type for compiler messages rather than relying on Format.formatter -> unit closures. (Florian Angeletti, review by Gabriel Scherer)

  • #13193: Remove the unused env_init field from class blocks (Vincent Laviron, review by Jacques Garrigue)

  • #13257: integrate MetaOCaml in the Menhir grammar to ease MetaOCaml maintenance. This is a purely internal change: there is no support in the lexer, so no change to the surface OCaml grammar. (Oleg Kiselyov, Gabriel Scherer and Florian Angeletti, review by Jeremy Yallop)

  • #13289: Use C99 for loop to reduce the scope of the for loop iterator. (Antonin Décimo, review by Miod Vallat and Gabriel Scherer)

  • #13336: compiler-libs, split the Printtyp in three to only keep "user-friendly" functions in the Printtyp module. (Florian Angeletti, review by Gabriel Scherer)

  • #13361: split runtime/array.c functions to consistently expose uniform_array and floatarray versions, use floatarray versions in Float.Array. (Gabriel Scherer, review by Nicolás Ojeda Bär)

  • #13507: A small refactoring to [free_vars] to make it a bit faster by not allocating a list when the list is not necessary. (Richard Eisenberg, review by Jacques Garrigue)

Build system:

  • #12909: Reorganise how MKEXE_VIA_CC is built to make it correct for MSVC by grouping all the linker flags at the end of the C compiler commandline (David Allsopp and Samuel Hym, review by Nicolás Ojeda Bär)

  • #12992, #13009: Check that flexlink can be executed only when building in a native windows environment. (Romain Beauxis, review by David Allsopp and Sébastien Hinderer)

  • #12996: Only link with -lgcc_eh when available. (Romain Beauxis, review by David Allsopp and Miod Vallat)

  • (breaking change) #13200: Do not use CFLAGS for linking. (Sébastien Hinderer, review by Gabriel Scherer, Antonin Décimo, Miod Vallat and Samuel Hym)
  • #13201, #13244: Fix and speedup builds with TSan. (Sébastien Hinderer, review by Miod Vallat, Gabriel Scherer and Olivier Nicole)
  • (breaking change) #12578, #12589, #13322, #13519: Use configured CFLAGS and CPPFLAGS only during the build of the compiler itself. Do not use them when compiling third-party C sources through the compiler. Flags for compiling third-party C sources can still be specified at configure time in the COMPILER_{BYTECODE,NATIVE}_{CFLAGS,CPPFLAGS} configuration variables. (Sébastien Hinderer, report by William Hu, review by David Allsopp)

Bug fixes:

  • #12854: Add a test in the regression suite that flags the bug #12825. (Luc Maranget)

  • #12888: fix printing of uncaught exceptions in .cmo files passed on the command-line of the toplevel. (Nicolás Ojeda Bär, review by Florian Angeletti, report by Daniel Bünzli)

  • #12910, #12920: Fix an unsound interaction between first-class modules and polymorphic records by saving and restoring univar_pairs. (Stephen Dolan, review by Gabriel Scherer, report by Jeremy Yallop)

  • #12994: Remove un-used and unsafe caml_drop_continuation (Tim McGilchrist, reviewed by Gabriel Scherer and Miod Vallat)

  • #12963: Restore caml_runtime_parameters implementation. This primitive allows programs to query the runtime parameters supplied to an OCaml program. Implementation missing since OCaml 5.0. (Tim McGilchrist, reviewed by David Allsopp and Miod Vallat)

  • #13012: parsing: Fix dropped attributes after a '-' or '+' The syntax '-(1 [@foo])' was incorrectly parsed as '-1'. (Jules Aguillon, reviewed by Gabriel Scherer, report by Gabriel Scherer)

  • (breaking change) #13070: On Windows, when configured with bootstrapped flexdll, don't add +flexdll to the search path when -nostdlib is specified (which then means -L no longer gets passed to the system linker). (David Allsopp, review by Florian Angeletti)
  • #13089: Fix bug in runtime_events library which could result in garbled output under Windows. (B. Szilvasy, review by Nicolás Ojeda Bär and Miod Vallat)

  • #13088: A few type-checker behaviors look at a type to see if there are any labeled arguments in it. This sometimes required expansion, which could, in obscure scenarios, result in superfluous type errors. (Richard Eisenberg, review by Gabriel Scherer and Jacques Garrigue)

  • #13103: FreeBSD/amd64: properly annotate .o files with non-executable stack notes (Konstantin Belousov, review by Nicolás Ojeda Bär)

  • #13150: improve a transitive-closure computation algorithm in the flambda middle-end to avoid a compilation time blowup on Menhir-generated code (Florian Weimer, review by Gabriel Scherer and Pierre Chambart, report by Richard Jones)

  • #13166: Fix a MinGW/MSVC Sys.rename regression on renaming a parent directory to an empty child directory. (Jan Midtgaard, review by Antonin Décimo, Sébastien Hinderer, and David Allsopp)

  • #13185, #13192: Reject type-level module aliases on functor parameter inside signatures. (Jacques Garrigue, report by Richard Eisenberg, review by Florian Angeletti)

  • #13170: Fix a bug that would result in some floating alerts [@@@alert ...] incorrectly triggering Warning 53. (Nicolás Ojeda Bär, review by Chris Casinghino and Florian Angeletti)

  • #13203: Do not issue warning 53 if the compiler is stopping before attributes have been accurately marked. (Chris Casinghino, review by Florian Angeletti)

  • #13207: Be sure to reload the register caching the exception handler in caml_c_call and caml_c_call_stack_args, as its value may have been changed if the OCaml stack is expanded during a callback. (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and Xavier Leroy)

  • #13209: Fix configure test that checks whether ar supports @FILE arguments. (Nicolás Ojeda Bär, report by Boris D.)

  • #13221: Compute more accurate instruction sizes for branch relocation on POWER. (Miod Vallat, review by Gabriel Scherer)

  • #13252: Rework register assignment in the interpreter code on m68k on Linux, due to the %a5 register being used by Glibc. (Miod Vallat, report by Stéphane Glondu, review by Gabriel Scherer and Xavier Leroy)

  • #13247: Disable lib_unix/kill test for MacOS AMD64 with TSan, linking to llvm bug report causing infinite signal loops. (Tim McGilchrist, review by Olivier Nicole, Miod Vallat, Sébastien Hinderer and Gabriel Scherer)

  • #13234, #13267: Open runtime events file in read-write mode on armel (armv5) systems due to atomic operations limitations on that platform. (Stéphane Glondu, review by Miod Vallat and Vincent Laviron)

  • #13273: Fix a call to test in configure.ac that was causing errors when LDFLAGS contains several words. (Stéphane Glondu, review by Miod Vallat)

  • #13290: Fix uninitialized and out of bounds reads in runtime_events_consumer.c (Edwin Török, review by Miod Vallat and Antonin Décimo)

  • #13306: An algorithm in the type-checker that checks two types for equality could sometimes, in theory, return the wrong answer. This patch fixes the oversight. No known program triggers the bug. (Richard Eisenberg, review by Florian Angeletti)

  • #13400: Initialize th->signal_stack to avoid free of uninitialized data if the user calls caml_c_thread_unregister on the main thread. (Richard W.M. Jones, review by Guillaume Munch-Maccagnoni and Gabriel Scherer)

  • #13140: POWER back-end: fix issue with call to caml_call_realloc_stack from a DLL (Xavier Leroy, review by Miod Vallat)

  • #13263, #13560: fix printing true and false in toplevel and error messages (no more unexpected #true) (Florian Angeletti, report by Samuel Vivien, review by Gabriel Scherer)

  • #13388, #13540: raises an error message (and not an internal compiler error) when two local substitutions are incompatible (for instance module type S:=sig end type t:=(module S)) (Florian Angeletti, report by Nailen Matschke, review by Gabriel Scherer, and Leo White)

  • #13408: Fix misplaced debug runtime assertion triggerable by a race between domain exit and backup thread (Miod Vallat and Gabriel Scherer, report by Jan Midtgaard)

  • #13417: Filename.quote_command: fix handling of forward slashes in program path under Win32. (Nicolás Ojeda Bär, review by David Allsopp and Damien Doligez)

  • #13501: Regression on mutually recursive types caused by #12180. Resuscitate Typedecl.update_type. (Jacques Garrigue and Takafumi Saikawa, review by Florian Angeletti, Richard Eisenberg and Gabriel Scherer)

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13495, #13514: Fix typechecker crash while typing objects (Jacques Garrigue, report by Nicolás Ojeda Bär, review by Nicolas Ojeda Bär, Gabriel Scherer, Stephen Dolan, Florian Angeletti)

  • #13391, #13551: fix a printing bug with -dsource when using raw literal inside a locally abstract type constraint (i.e. let f: type \#for. ... ) (Florian Angeletti, report by Nick Roberts, review by Richard Eisenberg)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

  • #13541, #13591: Fix headers for C++ inclusion. (Antonin Décimo, review by Nick Barnes, report by Kate Deplaix)

  • #13579, #13583: Unsoundness involving non-injective types + gadts (Jacques Garrigue, report by @v-gb, review by Richard Eisenberg and Florian Angeletti)

  • #13598: Falsely triggered warning 56 [unreachable-case] This was caused by unproper protection of the retyping function. (Jacques Garrigue, report by Tõivo Leedjärv, review by Florian Angeletti)

  • #13603, #13604: fix source printing in the presence of the escaped raw identifier \#mod. (Florian Angeletti, report by Chris Casinghino, review by Gabriel Scherer)

We are excited to share the release of OCaml-LSP 1.20.1, which introduces powerful new features and vital bug fixes to improve your development workflow. The new typeSearch request allows you to find values by type signature or polarity, making it easier to locate the functionality you need. Configurable MerlinJump actions and the custom jump request give you more control over code navigation. On the bug fix side, we have tackled issues like file descriptor leaks, enhanced method completion, and cleaned up duplicate responses in selectionRange.

See full changelog

Features

  • Add custom ocamllsp/typeSearch request (#1369)
  • Make MerlinJump code action configurable (#1376)
  • Add custom ocamllsp/jump request (#1374)

Fixes

  • Deactivate the jump code actions by default. Clients can enable them with the merlinJumpCodeActions configuration option. Alternatively, a custom request is provided for ad hoc use of the feature. (#1411)
  • Fix FD leak in running external processes for preprocessing (#1349)
  • Fix prefix parsing for completion of object methods (#1363, fixes #1358)
  • Remove some duplicates in the selectionRange answers (#1368)

This release introduces Merlin 5.3-502, compatible with OCaml 5.2, and 4.18-414, compatible with OCaml 4.14. Key updates include EXCLUDE_QUERY_DIR for better file management, resolving exceptions in polarity search,

and stabilizing type-enclosing results. For users of 5.3-502, additional enhancements address path resolution issues, fixes jump to fun functionality, and ensure proper handling of occurrences from hidden source files.

See full changelog
  • merlin binary

    • Respect the EXCLUDE_QUERY_DIR configuration directive when looking for cmt files #1854
    • Fix exception in polarity search (#1858 fixes #1113)
    • Fix type-enclosing results instability. This reverts some overly aggressive deduplication that should be done on the client side. #1864
  • merlin binary (only in 5.3-502)

    • Fix occurrences bug in which relative paths in index files are resolved against the PWD rather than the SOURCE_ROOT #1855
    • Fix jump to fun targets not working (#1863, fixes #1862)
    • Fix occurrences not working when the definition comes from a hidden source file #1865

Dune 3.17.1

The Dune team is happy to announce the release of Dune 3.17.1!

This patch release includes some bug fixes. To reduce computing time, it does not build .cmxs files anymore when the (no_dynlink) stanza is used instead. This behavior also corrects the semantic of the (no_dynlink) stanza which was building but not installing .cmxs files. It does not try to build and install them anymore.

See full changelog

Fixed

  • When a library declares (no_dynlink), then the .cmxs file for it is no longer built. (#11176, @nojb)

  • Fix bug that could result in corrupted file copies by Dune, for example when using the copy_files# stanza or the copy# action. (@nojb, #11194, fixes #11193)

  • Remove useless error message when running $ dune subst in empty projects. (@rgrinberg, #11204, fixes #11200)

Odoc 2.4.4

We're happy to announce the release of Odoc 2.4.4 which brings compatibility with OCaml 5.3!

See full changelog

Added

After almost a year of work, OCamlformat 0.27.0 is finally available with support for 5.3 syntax!

This release includes the new function syntax from OCaml 5.2, the effect keyword from OCaml 5.3 and a large number of bug fixes and improvements.

An other notable change, is that comments are now formatted by default.

See full changelog

Highlight

  • * Support OCaml 5.2 syntax (#2519, #2544, #2590, #2596, #2621, #2628, @Julow, @EmileTrotignon, @hhugo) This includes local open in types, raw identifiers, and the new representation for functions. This might change the formatting of some functions due to the formatting code being completely rewritten.

  • Support OCaml 5.3 syntax (#2609, #2610, #2611, #2622, #2623, #2562, #2624, #2625, #2627, @Julow, @Zeta611) This adds support for effect patterns, short functor type arguments and utf8 identifiers. To format code using the new effect syntax, add this option to your .ocamlformat:

    ocaml-version = 5.3
    
  • Documentation comments are now formatted by default (#2390, @Julow) Use the option parse-docstrings = false to restore the previous behavior.

  • * Consistent indentation of polymorphic variant arguments (#2427, @Julow) Increases the indentation by one to make the formatting consistent with normal variants. For example:

      ...
      (* before *)
        (`Msg
          (foo bar))
      (* after *)
        (`Msg
           (foo bar))
    
  • Build on OCaml 5.3 (#2603, @adamchol, @Julow)

Added

  • Improve the emacs plugin (#2577, #2600, @gridbugs, @thibautbenjamin) Allow a custom command to be used to run ocamlformat and add compatibility with emacs ocaml tree-sitter modes.

  • Added option let-binding-deindent-fun (#2521, @henrytill) to control the indentation of the fun in:

    let f =
     fun foo ->
      bar
    
  • Added back the flag --disable-outside-detected-project (#2439, @gpetiot) It was removed in version 0.22.

  • Support newer Odoc syntax (#2631, #2632, #2633, @Julow)

Changed

  • * Consistent formatting of comments (#2371, #2550, @Julow) This is mostly an internal change but some comments might be formatted differently.

  • * Improve formatting of type constraints with type variables (#2437, @gpetiot) For example:

    let f : type a b c.
        a -> b -> c =
      ...
    
  • * Improve formatting of functor arguments (#2505, @Julow) This also reduce the indentation of functor arguments with long signatures.

  • Improvements to the Janestreet profile (#2445, #2314, #2460, #2593, #2612, @Julow, @tdelvecchio-jsc)

  • * Undo let-bindings and methods normalizations (#2523, #2529, @gpetiot) This remove the rewriting of some forms of let-bindings and methods:

    • let f x = (x : int) is no longer rewritten into let f x : int = x
    • let f (type a) (type b) ... is no longer rewritten into let f (type a b) ...
    • let f = fun x -> ... is no longer rewritten into let f x = ...
  • * The break-colon option is now taken into account for method type constraints (#2529, @gpetiot)

  • * Force a break around comments following an infix operator (fix non-stabilizing comments) (#2478, @gpetiot) This adds a line break:

      a
      ||
      (* this comment is now on its own line *)
      b
    

Fixed

  • Fix placement of comments in some cases (#2471, #2503, #2506, #2540, #2541, #2592, #2617, @gpetiot, @Julow) Some comments were being moved or causing OCamlformat to crash. OCamlformat refuses to format if a comment would be missing in its output, to avoid loosing code.
  • Fix attributes being dropped or moved (#2247, #2459, #2551, #2564, #2602, @EmileTrotignon, @tdelvecchio-jsc, @Julow) OCamlformat refuses to format if the formatted code has a different meaning than the original code, for example, if an attribute is removed. We also try to avoid moving attributes even if that doesn't change the original code, for example we no longer format open[@attr] M as open M [@@attr].
  • Remove trailing space inside a wrapping empty signature (#2443, @Julow)
  • Fix extension-point spacing in structures (#2450, @Julow)
  • * Consistent break after string constant argument (#2453, @Julow)
  • * Fix cinaps comment formatting to not change multiline string contents (#2463, @tdelvecchio-jsc)
  • * Fix the indentation of tuples in attributes and extensions (#2488, @Julow)
  • * Fix weird indentation and line breaks after comments (#2507, #2589, #2606, @Julow)
  • * Fix unwanted alignment in if-then-else (#2511, @Julow)
  • Fix missing parentheses around constraint expressions with attributes (#2513, @alanechang)
  • Fix formatting of type vars in GADT constructors (#2518, @Julow)
  • Fix [@ocamlformat "disable"] in some cases (#2242, #2525, @EmileTrotignon) This caused a bug inside class type constructs and when attached to a let ... in
  • Display a##b instead of a ## b and similarly for operators that start with # (#2580, @v-gb)
  • * Fix arrow type indentation with break-separators=before (#2598, @Julow)
  • Fix missing parentheses around a let in class expressions (#2599, @Julow)
  • Fix formatting of paragraphs in lists in documentation (#2607, @Julow)
  • Avoid unwanted space in references and links text in documentation (#2608, @Julow)
  • * Improve the indentation of attributes in patterns (#2613, @Julow)
  • * Avoid large indentation in patterns after let%ext (#2615, @Julow)

Dune 3.17.0

We're happy to announce the release of Dune 3.17.0.

Among the list of chances, this release enables the Dune cache by default for known-safe operations, adds support for Wasm_of_ocaml, adds support for the -H compiler flag introduced in OCaml 5.2 and allows specifying code hosting services like Codeberg or Gitlab organizations.

See full changelog

Fixed

  • Show the context name for errors happening in non-default contexts. (#10414, fixes #10378, @jchavarri)

  • Correctly declare dependencies of indexes so that they are rebuilt when needed. (#10623, @voodoos)

  • Don't depend on coq-stdlib being installed when expanding variables of the coq.version family (#10631, fixes #10629, @gares)

  • Error out if no files are found when using copy_files. (#10649, @jchavarri)

  • Re_export dune-section private library in the dune-site library stanza, in order to avoid failure when generating and building sites modules with implicit_transitive_deps = false. (#10650, fixes #9661, @MA0100)

  • Expect test fixes: support multiple modes and fix dependencies when there is a custom runner (#10671, @vouillon)

  • In a (library) stanza with (extra_objects) and (foreign_stubs), avoid double linking the extra object files in the final executable. (#10783, fixes #10785, @nojb)

  • Map (re_export) library dependencies to the exports field in META files, and vice-versa. This field was proposed in to https://discuss.ocaml.org/t/proposal-a-new-exports-field-in-findlib-meta-files/13947. The field is included in Dune-generated META files only when the Dune lang version is >= 3.17. (#10831, fixes #10830, @nojb)

  • Fix staged pps preprocessors on Windows (which were not working at all previously) (#10869, fixes #10867, @nojb)

  • Fix dune describe when an executable is disabled with enabled_if. (#10881, fixes #10779, @moyodiallo)

  • Fix an issue where C stubs would be rebuilt whenever the stderr of Dune was redirected. (#10883, fixes #10882, @nojb)

  • Fix the URL opened by the command dune ocaml doc. (#10897, @gridbugs)

  • Fix the file referred to in the error/warning message displayed due to the dune configuration version not supporting a particular configuration stanza in use. (#10923, @H-ANSEN)

  • Fix enabled_if when it uses env variable. (#10936, fixes #10905, @moyodiallo)

  • Fix exec -w for relative paths with --root argument (#10982, @gridbugs)

  • Do not ignore the (locks ..) field in the test and tests stanza (#11081, @rgrinberg)

  • Tolerate files without extension when generating merlin rules. (#11128, @anmonteiro)

Added

  • Make Merlin/OCaml-LSP aware of "hidden" dependencies used by (implicit_transitive_deps false) via the -H compiler flag. (#10535, @voodoos)

  • Add support for the -H flag (introduced in OCaml compiler 5.2) in dune (requires lang versions 3.17). This adaptation gives the correct semantics for (implicit_transitive_deps false). (#10644, fixes #9333, ocsigen/tyxml#274, #2733, #4963, @MA0100)

  • Add support for specifying Gitlab organization repositories in source stanzas (#10766, fixes #6723, @H-ANSEN)

  • New option to control jsoo sourcemap generation in env and executable stanza (#10777, fixes #10673, @hhugo)

  • One can now control jsoo compilation_mode inside an executable stanza (#10777, fixes #10673, @hhugo)

  • Add support for specifying default values of the authors, maintainers, and license stanzas of the dune-project file via the dune config file. Default values are set using the (project_defaults) stanza (#10835, @H-ANSEN)

  • Add names to source tree events in performance traces (#10884, @jchavarri)

  • Add codeberg as an option for defining project sources in dune-project files. For example, (source (codeberg user/repo)). (#10904, @nlordell)

  • dune runtest can now run individual tests with dune runtest mytest.t (#11041, @Alizter).

  • Wasm_of_ocaml support (#11093, @vouillon)

  • Add a coqdep_flags field to the coq field of the env stanza, and to the coq.theory stanza, allowing to configure coqdep flags. (#11094, @rlepigre)

Changed

  • Remove all remnants of the experimental patch-back-source-tree. (#10771, @rgrinberg)

  • Change the preset value for author and maintainer fields in the dune-project file to encourage including emails. (#10848, @punchagan)

  • Tweak the preset value for tags in the dune-project file to hint at topics not having a special meaning. (#10849, @punchagan)

  • Change some colors to improve readability in light-mode terminals (#10890, @gridbugs)

  • Forward the linkall flag to jsoo in whole program compilation as well (#10935, @hhugo)

  • Configurator uses pkgconf as pkg-config implementation when available and forwards it the target of ocamlc -config. (#10937, @pirbo)

  • Enable Dune cache by default. Add a new Dune cache setting enabled-except-user-rules, which enables the Dune cache, but excludes user-written rules from it. This is a conservative choice that can avoid breaking rules whose dependencies are not correctly specified. This is the current default. (#10944, #10710, @nojb, @ElectreAAS)

  • Do not add dune dependency in dune-project when creating projects with dune init proj. The Dune dependency is implicitely added when generating opam files (#11129, @Leonidas-from-XIV)

We have the pleasure of announcing the release of OCaml 5.2.1, dedicated to the memory of Niels Bohr and Paul Éluard on the anniversary of their deaths.

OCaml 5.2.1 is a collection of safe but import runtime time bug fixes backported from the 5.3 branch of OCaml.

The full list of changes is available above for more details.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 5.2.1

The source code for the release is also directly available on:

See full changelog

Changes Since OCaml 5.2.0

Runtime System:

  • #13207: Be sure to reload the register caching the exception handler in caml_c_call and caml_c_call_stack_args, as its value may have been changed if the OCaml stack is expanded during a callback. (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and Xavier Leroy)

  • #13252: Rework register assignment in the interpreter code on m68k on Linux, due to the %a5 register being used by GLIBC. (Miod Vallat, report by Stéphane Glondu, review by Gabriel Scherer and Xavier Leroy)

  • #13268: Fix a call to test in configure.ac that was causing errors when LDFLAGS contains several words. (Stéphane Glondu, review by Miod Vallat)

  • #13234, #13267: Open runtime events file in read-write mode on ARMel (ARMv5) systems due to atomic operations limitations on that platform. (Stéphane Glondu, review by Miod Vallat and Vincent Laviron)

  • #13188: fix races in the FFI code coming from the use of Int_val(...) on rooted values inside blocking questions / without the runtime lock. (Calling Int_val(...) on non-rooted immediates is fine, but any access to rooted values must be done outside blocking sections / with the runtime lock.) (Etienne Millon, review by Gabriel Scherer, Jan Midtgaard, Olivier Nicole)

  • #13318: Fix regression in GC alarms, and fix them for Flambda. (Guillaume Munch-Maccagnoni, report by Benjamin Monate, review by Vincent Laviron and Gabriel Scherer)

  • #13140: POWER back-end: fix issue with call to caml_call_realloc_stack from a DLL (Xavier Leroy, review by Miod Vallat)

  • #13370: Fix a low-probability crash when calling Gc.counters. (Demi Marie Obenour, review by Gabriel Scherer)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

opam 2.3.0

Feedback on this post is welcomed on Discuss!

As mentioned in our talk at the OCaml Workshop 2024, we decided to switch to a time-based release cycle (every 6 months), starting with opam 2.3.

As promised, we are very pleased to announce the release of opam 2.3.0, and encourage all users to upgrade. Please read on for installation and upgrade instructions.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam or $env:LOCALAPPDATA\opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Major breaking change: extra-files

When loading a repository, opam now ignores files in packages' files/ directories which aren't listed in the extra-files field of the opam file. This was done to simplify the opam specification where we hope the opam file to be the only thing that you have to look at when reading a package specification. It being optional to list all files in the extra-files: field went against that principle. This change also reduces the surface area for potential file corruption as all extra-files must have checksums.

This is a breaking change and means that if you are using the files/ directory without listing them in the extra-files: field, you need to make sure that all files in that directory are included in the extra-files field. The resulting opam file remains compatible with all previous opam 2.x releases.

If you have an opam repository, you should make sure all files are listed so every packages continues to work without any issue, which can be done automatically using the opam admin update-extrafiles command.

Major changes

  • Packages requiring an unsupported version of opam are now marked unavailable, instead of causing a repository error. This means an opam repository can now allow smoother upgrade in the future where some packages can require a newer version of opam without having to fork the repository to upgrade every package to that version as was done for the upgrade from opam 1.2 to 2.0

  • Add a new opam list --latests-only option to list only the latest versions of packages. Note that this option respects the order options were given on the command line. For example: --available --latests-only will first list all the available packages, then choose only the latest packages in that set; while --latests-only --available will first list all the latest packages, then only show the ones that are available in that set

  • Fix and improve opam install --check, which now checks if the whole dependency tree of the package is installed instead of only the root dependencies

  • Add a new --verbose-on option to enable verbose output for specified package names. Thanks to @desumn for this contribution

  • Add a new opam switch import --deps-only option to install only the dependencies of the root packages listed in the opam switch export file

  • opam switch list-available no longer displays compilers flagged with avoid-version/deprecated unless --all is given, meaning that pre-release or unreleased OCaml packages no longer appear to be the latest version

  • opam switch create --repositories now correctly infers --kind=git for URLs ending with .git rather than requiring the git+https:// protocol. This is consistant with other commands such as opam repository add. Thanks to @Keryan-dev for this contribution

  • opam switch set-invariant now displays the switch invariant using the same syntax as the --formula flag

  • The builtin-0install solver was improved and should now be capable of being your default solver instead of builtin-mccs+glpk. It was previously mostly only suited for automated tasks such as Continuous Integration. If you wish to give it a try, simply calling opam option solver=builtin-0install (call opam option solver= restores the default)

  • Most of the unhelpful conflict messages were fixed. (#4373)

  • Fix an opam 2.1 regression where the initial pin of a local VCS directory would store untracked and ignored files. Those files would usually be cleaned before building the package, however git submodules would not be cleaned and would cause issues when paired with the new behaviour added in 2.3.0~alpha1 which makes opam error when git submodules fail to update (it was previously a warning). (#5809)

  • Fix the value of the arch variable when the current OS is 32bit on a 64bit machine (e.g. Raspberry Pi OS). (#5949)

  • opam now fails when git submodules fail to update instead of ignoring the error and just showing a warning

  • opam's libraries now compile with OCaml >= 5.0 on Windows

  • Fix the installed packages internal cache, which was storing the wrong version of the opam file after a build failure. This could be triggered easily for users with custom repositories with non-populated extra-files. (#6213)

  • Several improvements to the pre-built release binaries were made:

    • The Linux binaries are now built on Alpine 3.20
    • The FreeBSD binary is now built on FreeBSD 14.1
    • The OpenBSD binary is now built on OpenBSD 7.6 and loses support for OpenBSD 7.5 and earlier
    • Linux/riscv64 and NetBSD/x86_64 binaries are now available

And many other general, performance and UI improvements were made and bugs were fixed. You can take a look to previous blog posts. API changes and a more detailed description of the changes are listed in:

This release also includes PRs improving the documentation and improving and extending the tests.

Please report any issues to the bug-tracker.

We hope you will enjoy the new features of opam 2.3!

Dune 3.16.1

We're happy to announce the release of Dune 3.16.1.

This is a patch release that fixes an issue with OCaml.5.3.0 and C++ flags.

See full changelog

Fixed

  • Call the C++ compiler with -std=gnu++11 when using OCaml >= 5.0 (#10962, @kit-ty-kate)

    Added

We are happy to announce the joint release of Merlin 5.2.1-502 and 4.17.1. This release adds many new features to Merlin including the ability to add hints to a source tree, serch for values using a type signature and expanding PPX annotations to preview their source code. There are also bug fixes for both the Merlin binary and editor modes.

More information can be found in the Discuss announcement.

Contributions are always welcome at Merlin | Issues

See full changelog
  • merlin binary
    • A new WRAPPING_PREFIX configuration directive that can be used to tell Merlin what to append to the current unit name in the presence of wrapping (ocaml/merlin#1788)
    • Add -unboxed-types and -no-unboxed-types as OCaml ignored flags (ocaml/merlin#1795, fixes ocaml/merlin#1794)
    • Destruct: Refinement in the presence of optional arguments (ocaml/merlin#1800 ocaml/merlin#1807, fixes ocaml/merlin#1770)
    • Implement new expand-node command for expanding PPX annotations (ocaml/merlin#1745)
    • Implement new inlay-hints command for adding hints on a source tree (ocaml/merlin#1812)
    • Implement new search-by-type command for searching values by types (ocaml/merlin#1828)
    • Canonicalise paths in occurrences. This helps deduplicate the results and
    • Show more user-friendly paths. (ocaml/merlin#1840)
    • Fix dot-merlin-reader ignoring SOURCE_ROOT and STDLIB directives (ocaml/merlin#1839, ocaml/merlin#1803)
  • editor modes
    • Vim:
      • Fix Python-3.12 syntax warnings in merlin.py (ocaml/merlin#1798)
      • Dead code / doc removal for previously deleted MerlinPhrase command (ocaml/merlin#1804)
    • Emacs:
      • Improve the way that result of polarity search is displayed (#1814)
      • Add merlin-search-by-type, merlin-search-by-polarity and change the behaviour of merlin-search to switch between by-type or by-polarity depending on the query (ocaml/merlin#1828)

Odoc 2.4.3

We're happy to announce the release of Odoc 2.4.3!

This release includes three key fixes: we restored missing KaTeX headers for proper mathematical rendering, resolved an issue where ][ characters in code blocks were incorrectly interpreted as "code blocks with result" (now requiring explicit delimiters), and corrected the misprinting of type variables from ML files in OCaml 4.14 and later versions where multiple instances of the same type variable could be displayed with different names.

See full changelog

Fixed

  • Fix missing katex headers (@panglesd, #1096)
  • Allow ][ in code blocks, fixing issue #1137 (@Julow, #1149)
    This was interpreted as "code blocks with result", which now mandates a
    delimiter: {delim@lang[ code ]delim[ result ]}
  • Fix misprinting of type variables from ml files for OCaml 4.14 and later
    (multiple occurences of the same type variable could be named differently)
    (@Octachron, #1173)

opam 2.2.1

Feedback on this post is welcomed on Discuss!

We are pleased to announce the release of opam 2.2.1.

We've fixed a couple of regressions and would like to encourage users of opam 2.2 to upgrade.

Changes

The three main changes are:

  • Fixe a regression in opam install --deps-only where the direct dependencies were not set as root packages (spotted in the wild by @rjbou and also reported on Discuss)
  • Fix a regression when fetching Git packages where the resulting Git repository could lead to unexpected outputs of Git commands, by disabling shallow clone by default except when fetching opam repositories (#6145)
  • Mitigate curl/curl#13845 by falling back from --write-out to --fail if exit code 43 is returned by Curl. In particular, this fixes opam init when run from cmd/PowerShell on Windows 11 23H2 (#6120)

A couple more improvements and additions to the testsuite were made. You can view the full list of changes in the release note.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

(or via winget upgrade OCaml.opam) or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

We are pleased to announce the release of OCaml LSP 1.19.0. This version brings official support for OCaml 5.2. It also includes a new custom query to get

documentation and a fix regarding the handling of OCamlFormat processes.

See full changelog

Features

Fixes

  • Kill unnecessary OCamlFormat processes with sigterm rather than sigint or sigkill (ocaml/ocaml-lsp#1343)

The Ppxlib dev team is happy to announce the release of ppxlib.0.33.0.

This release's main feature is a series of improvement to flags controlling unused value/module/type warnings silencing. The ppxlib driver generates warning silencing items to prevent [@@deriving ...] generated code to trigger unused code warnings. Three warnings are disabled that way:

  • Warning 32: unused value
  • Warning 60: unused module
  • Warning 34: unused type The first two are disabled for values and modules generated by the deriver while the third is disabled for the types in the type declaration to which the [@@deriving ...] attribute is attached. This feature was added a long time ago to avoid manually disabling those warnings when working with derivers that generate a set of values and modules only to use a subset of those. Alternatively, the unused type warning silencing was added to allow defining an alias type only to be consumed by a deriver (e.g., type error = [`Not_found | `Invalid_arg] [@@deriving to_string]). We since then believe that we should not disable warnings lightly, as this behaviour makes it difficult to find and remove deadcode. The right approach in those situations should be to fix the PPX derivers so that they are more configurable and can be used without triggering such warnings. We will start to move toward removing this feature, but since it is still useful in some places, we came up with a plan to do this iteratively. In ppxlib.0.31.0 we added the -unused-code-warnings driver flag and the ?unused_code_warnings Deriving.V2.make optional argument to control whether to silence Warnings 32 and 60. When both are set to true, by the user and the deriver authors, the warnings are not silenced. As of ppxlib.0.33.0, these also control the silencing of Warning 34 (unused type). force can now be passed to the -unused-code-warnings flag in order to disable warnings silencing, regardless of the derivers opting in. This allows users to test whether their codebase and their set of derivers rely on warning silencing or not and to use those results to eliminate deadcode and/or report issues upstream to the derivers they use. We also added a separate -unused-type-warnings flag that works similarly to -unused-code-warnings (i.e., depends on the value of the ?unused_code_warnings argument), but it only controls Warning 34 silencing, as it turns out it is less likely to cause unwanted warnings than with the other two. This will allow users to disable it more easily, without having to deal with Warnings 32 and 60 straight away. We want to encourage users to try those on their codebase in order to see the impact it has. Did you have deadcode lying around that slipped past undetected? Does this trigger unwanted warnings because of deriver's generated code? The plan is to give the ecosystem some time to try those features and adapt by fixing individual derivers and flipping setting ?unused_code_warnings to true as they do. After a while, we will swap the default value of the driver flag to true so that only derivers that haven't opted in will enable warning silencing. Then as time goes we will swap the default of the Deriving.make argument so that derivers will instead have to explicitly opt out to get the warning silencing. Finally, once we are confident the ecosystem is in a good enough state, we will remove this feature altogether.

ppxlib.0.33.0 also comes with a couple of new features for PPX authors:

  • A couple new Ast_builder functions: elist_tail and plist_tail that can be used to build list expressions and patterns with a custom tail: elist_tail [expr1; expr2] tail_expr returns the expression for expr1::expr2::tail_expr.
  • Context_free.special_function', a new version of special_function that allows passing a Longident.t directly rather that relying on parsing the string argument to a Longident.t.

Finally, the release includes a few bug fixes to Longident.parse and Code_path.main_module_name and fixes the location-check flag so it is not required to also pass -check to enable location checks. It also fixes the 5.2 migrations locations, as we used to build nodes with inconsistent locations when migrating Pexp_function nodes.

We would like to thank our external contributors who have been a huge part of this release: @octachron, @vg-b, and @jchavarri, and a special mention to @mbarbin, who has not only contributed a lot to the warning silencing features but has been extensively testing and providing very useful feedback on them.

And of course, as usual, we'd like to thank the OCaml Software Foundation who has been funding my work on Ppxlib and on this release, making all of this possible!

See full changelog
  • Fix a bug where Code_path.main_module_name would not properly remove extensions from the filename and therefore return an invalid module name. (#512, @NathanReb)

  • Add -unused-type-warnings flag to the driver to allow users to disable only the generation of Warning 34 silencing structure items when using [@@deriving ...] on type declarations. (#511, @mbarbin, @NathanReb)

  • Make the -unused-code-warnings driver flag also control Warning 34 silencing for type declarations with [@@deriving ...] attached. (#510, @mbarbin, @NathanReb)

  • Add -unused-code-warnings=force driver command-line flag argument. (#490, @mbarbin)

  • Add new functions Ast_builder.{e,p}list_tail that take an extra tail expression/pattern argument parameter compared to Ast_builder.{e,p}list, so they can build ASTs like a :: b :: c instead of only [ a; b ]. (#498, #502, @v-gb, @NathanReb)

  • Fix Longident.parse so it also handles indexing operators such as .!(), .%(;..)<-, or Vec.(.%()) (#494, @octachron)

  • Add a special_function' variant that directly takes a Longident.t argument in order to avoid the issue with Longident.t covering distinct syntactic classes that cannot be easily parsed by a common parser (#496, @octachron).

  • Keep location ranges consistent when migrating Pexp_function nodes from 5.2+ to older versions (#504, @jchavarri)

  • Fix -locations-check behaviour so it is no longer required to pass -check and can enable location checks. (#506, @NathanReb)

We are pleased to announce the release of OCaml LSP 1.18.0. This version comes with a lot of fixes and new features.

Notable features that are included in this release are:

  • Improved hover behavior with less noisy hovers on some parse tree nodes such as keywords, comments, etc., along with support for hovering over PPX annotations and preview the generated code.
  • Some additional custom queries, particularly TypeEnclosing
  • Folding ifthenelse expressions
  • A new configuration option to control Dune diagnostics
  • Improved document symbols

...and many fixes to a handful of issues.

Feedback is very much welcomed on the the Discuss Announcement post and do not hesistate to report issues in the issue tracker.

See full changelog

Features

  • Introduce a configuration option to control Dune diagnostics. The option is called duneDiganostics, and it may be set to { enable: false } to disable diagnostics. (ocaml/ocaml-lsp#1221)

  • Support folding of ifthenelse expressions (ocaml/ocaml-lsp#1031)

  • Improve hover behavior (ocaml/ocaml-lsp#1245)

    Hovers are no longer displayed on useless parse tree nodes such as keywords, comments, etc.

    Multiline hovers are now filtered away.

    Display expanded PPXs in the hover window.

  • Improve document symbols (ocaml/ocaml-lsp#1247)

    Use the parse tree instead of the typed tree. This means that document symbols will work even if the source code doesn't type check.

    Include symbols at arbitrary depth.

    Differentiate functions / types / variants / etc.

    This now includes PPXs like let%expect_test or let%bench in the outline.

  • Introduce a destruct-line code action. This is an improved version of the old destruct code action. (ocaml/ocaml-lsp#1283)

  • Improve signature inference to only include types for elements that were absent from the signature. Previously, all signature items would always be inserted. (ocaml/ocaml-lsp#1289)

  • Add an update-signature code action to update the types of elements that were already present in the signature (ocaml/ocaml-lsp#1289)

  • Add custom ocamllsp/merlinCallCompatible request (ocaml/ocaml-lsp#1265)

  • Add custom ocamllsp/typeEnclosing request (ocaml/ocaml-lsp#1304)

Fixes

  • Detect document kind by looking at Merlin's suffixes config.

    This enables more LSP features for non-.ml/.mli files. Though it still depends on Merlin's support. (ocaml/ocaml-lsp#1237)

  • Correctly accept the --clientProcessId flag. (ocaml/ocaml-lsp#1242)

  • Disable automatic completion and signature help inside comments (ocaml/ocaml-lsp#1246)

  • Includes a new optional/configurable option to toggle syntax documentation. If toggled on, allows display of syntax documentation on hover tooltips. Can be controlled via environment variables and by GUI for VS code. (ocaml/ocaml-lsp#1218)

  • For completions on labels that the LSP gets from Merlin, take into account whether the prefix being completed starts with ~ or ?. Change the label completions that start with ? to start with ~ when the prefix being completed starts with ~. (ocaml/ocaml-lsp#1277)

  • Fix document syncing (ocaml/ocaml-lsp#1278, ocaml/ocaml-lsp#1280, fixes ocaml/ocaml-lsp#1207)

  • Stop generating inlay hints on generated code (ocaml/ocaml-lsp#1290)

  • Fix parenthesising of function types in SignatureHelp (ocaml/ocaml-lsp#1296)

  • Fix syntax documentation rendering (ocaml/ocaml-lsp#1318)

opam 2.2.0

Feedback on this post is welcomed on Discuss!

We are very pleased to announce the release of opam 2.2.0, and encourage all users to upgrade. Please read on for installation and upgrade instructions.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam or $env:LOCALAPPDATA\opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Changes

Major change: Windows support

After 8 years' effort, opam and opam-repository now have official native Windows support! A big thank you is due to Andreas Hauptmann (@fdopen), whose WODI and OCaml for Windows projects were for many years the principal downstream way to obtain OCaml on Windows, Jun Furuse (@camlspotter) whose initial experimentation with OPAM from Cygwin formed the basis of opam-repository-mingw, and, most recently, Jonah Beckford (@jonahbeckford) whose DkML distribution kept - and keeps - a full development experience for OCaml available on Windows.

OCaml when used on native Windows requires certain tools from the Unix world which are provided by either Cygwin or MSYS2. We have engineered opam init so that it is possible for a user not to need to worry about this, with opam managing the Unix world, and the user being able to use OCaml from either the Command Prompt or PowerShell. However, for the Unix user coming over to Windows to test their software, it is also possible to have your own Cygwin/MSYS2 installation and use native Windows opam from that. Please see the previous blog post for more information.

There are two "ports" of OCaml on native Windows, referred to by the name of provider of the C compiler. The mingw-w64 port is GCC-based. opam's external dependency (depext) system works for this port (including providing GCC itself), and many packages are already well-supported in opam-repository, thanks to the previous efforts in opam-repository-mingw. The MSVC port is Visual Studio-based. At present, there is less support in this ecosystem for external dependencies, though this is something we expect to work on both in opam-repository and in subsequent opam releases. In particular, it is necessary to install Visual Studio or Visual Studio BuildTools separately, but opam will then automatically find and use the C compiler from Visual Studio.

Major change: opam tree / opam why

opam tree is a new command showing packages and their dependencies with a tree view. It is very helpful to determine which packages bring which dependencies in your installed switch.

$ opam tree cppo
cppo.1.6.9
├── base-unix.base
├── dune.3.8.2 (>= 1.10)
│   ├── base-threads.base
│   ├── base-unix.base [*]
│   └── ocaml.4.14.1 (>= 4.08)
│       ├── ocaml-base-compiler.4.14.1 (>= 4.14.1~ & < 4.14.2~)
│       └── ocaml-config.2 (>= 2)
│           └── ocaml-base-compiler.4.14.1 (>= 4.12.0~) [*]
└── ocaml.4.14.1 (>= 4.02.3) [*]

Reverse-dependencies can also be displayed using the new opam why command. This is useful to examine how dependency versions get constrained.

$ opam why cmdliner
cmdliner.1.2.0
├── (>= 1.1.0) b0.0.0.5
│   └── (= 0.0.5) odig.0.0.9
├── (>= 1.1.0) ocp-browser.1.3.4
├── (>= 1.0.0) ocp-indent.1.8.1
│   └── (>= 1.4.2) ocp-index.1.3.4
│       └── (= version) ocp-browser.1.3.4 [*]
├── (>= 1.1.0) ocp-index.1.3.4 [*]
├── (>= 1.1.0) odig.0.0.9 [*]
├── (>= 1.0.0) odoc.2.2.0
│   └── (>= 2.0.0) odig.0.0.9 [*]
├── (>= 1.1.0) opam-client.2.2.0~alpha
│   ├── (= version) opam.2.2.0~alpha
│   └── (= version) opam-devel.2.2.0~alpha
├── (>= 1.1.0) opam-devel.2.2.0~alpha [*]
├── (>= 0.9.8) opam-installer.2.2.0~alpha
└── user-setup.0.7

Special thanks to @cannorin for contributing this feature.

Major change: with-dev-setup

There is now a way for a project maintainer to share their project development tools: the with-dev-setup dependency flag. It is used in the same way as with-doc and with-test: by adding a {with-dev-setup} filter after a dependency. It will be ignored when installing normally, but it's pulled in when the package is explicitly installed with the --with-dev-setup flag specified on the command line.

For example

opam-version: "2.0"
depends: [
  "ocaml"
  "ocp-indent" {with-dev-setup}
]
build: [make]
install: [make "install"]
post-messages:
[ "Thanks for installing the package"
  "as well as its development setup. It will help with your future contributions" {with-dev-setup} ]

Major change: opam pin --recursive

When pinning a package using opam pin, opam looks for opam files in the root directory only. With recursive pinning, you can now instruct opam to look for .opam files in subdirectories as well, while maintaining the correct relationship between the .opam files and the package root for versioning and build purposes.

Recursive pinning is enabled by the following options to opam pin and opam install:

  • With --recursive, opam will look for .opam files recursively in all subdirectories.
  • With --subpath <path>, opam will only look for .opam files in the subdirectory <path>.

The two options can be combined: for instance, if your opam packages are stored as a deep hierarchy in the mylib subdirectory of your project you can try opam pin . --recursive --subpath mylib.

These options are useful when dealing with a large monorepo-type repository with many opam libraries spread about.

New Options

  • opam switch -, inspired by git switch -, makes opam switch back to the previously selected global switch.

  • opam pin --current fixes a package to its current state (disabling pending reinstallations or removals from the repository). The installed package will be pinned to its current installed state, i.e. the pinned opam file is the one installed.

  • opam pin remove --all removes all the pinned packages from a switch.

  • opam exec --no-switch removes the opam environment when running a command. It is useful when you want to launch a command without opam environment changes.

  • opam clean --untracked removes untracked files interactively remaining from previous packages removal.

  • opam admin add-constraint <cst> --packages pkg1,pkg2,pkg3 applies the given constraint to a given set of packages

  • opam list --base has been renamed into --invariant, reflecting the fact that since opam 2.1 the "base" packages of a switch are instead expressed using a switch invariant.

  • opam install --formula <formula> installs a formula instead of a list of packages. This can be useful if you would like to install one package or another one. For example opam install --formula '"extlib" |"extlib-compat"' will install either extlib or extlib-compat depending on what's best for the current switch.

Miscellaneous changes

  • The UI now displays a status when extracting an archive or reloading a repository
  • Overhauled the implementation of opam env, fixing many corner cases for environment updates and making the reverting of package environment variables precise. As a result, using setenv in an opam file no longer triggers a lint warning.
  • Fix parsing pre-opam 2.1.4 switch import files containing extra-files
  • Add a new sys-ocaml-system default global eval variable
  • Hijack the "%{var?string-if-true:string-if-false-or-undefined}%" syntax to support extending the variables of packages with + in their name (conf-c++ and conf-g++ already exist) using "%{?pgkname:var:}%"
  • Fix issues when using fish as shell
  • Sandbox: Mark the user temporary directory (as returned by getconf DARWIN_USER_TEMP_DIR) as writable when TMPDIR is not defined on macOS
  • Add Warning 69: Warn for new syntax when package name in variable in string interpolation contains several '+' (this is related to the "hijack" item above)
  • Add support for Wolfi OS, treating it like Alpine family as it also uses apk
  • Sandbox: /tmp is now writable again, restoring POSIX compliance
  • Add a new opam admin: new add-extrafiles command to add/check/update the extra-files: field according to the files present in the files/ directory
  • Add a new opam lint -W @1..9 syntax to allow marking a set of warnings as errors
  • Fix bugs in the handling of the OPAMCURL, OPAMFETCH and OPAMVERBOSE environment variables
  • Fix bugs in the handling of the --assume-built argument
  • Software Heritage fallbacks is now supported, but is disabled-by-default for now. For more information you can read one of our previous blog post

And many other general and performance improvements were made and bugs were fixed. You can take a look to previous blog posts. API changes and a more detailed description of the changes are listed in:

This release also includes PRs improving the documentation and improving and extending the tests.

Please report any issues to the bug-tracker.

We hope you will enjoy the new features of opam 2.2! 📯

We are pleased to announce the release of Merlin 5.1-502. This is an important release that brings a lot of backend changes and a major new feature: project-wide occurrences queries.

Try it by running dune build @ocaml-index (since dune 3.16.0) and performing a reference query!

More information can be found in the discuss announcement and the wiki.

See full changelog
  • merlin binary
    • Support project-wide occurrences queries using index files (ocaml/merlin#1766)
      • The file format is described in library Merlin_lib.index_format
      • Two new configuration directives are introduced:
        • SOURCE_ROOT that is used to resolve relative paths found in the indexes.
        • INDEX that is used to declare the list of index files Merlin should use when looking for occurrences.
    • A new UNIT_NAME configuration directive that can be used to tell Merlin the correct name of the current unit in the presence of wrapping (ocaml/merlin#1776)
    • Perform incremental indexation of the buffer when typing. (ocaml/merlin#1777)
    • merlin-lib.commands: Add a find_command_opt alternative to find_command that does not raise (ocaml/merlin#1778)
    • Prevent uid clashes by not returning PWO for defs located in the current interface file (ocaml/merlin#1781)
    • Reset uid counters when restoring the typer cache so that uids are stable across re-typing (ocaml/merlin#1779)
    • Improve the behavior on occurrences when the cursor is on a label / constructor declaration (ocaml/merlin#1785)
  • editor modes
    • emacs: add basic support for project-wide occurrences (ocaml/merlin#1766)
    • vim: add basic support for project-wide occurrences (ocaml/merlin#1767, @Julow)

Dune 3.16.0

We're happy to announce the release of Dune 3.16.0.

Among the list of chances, this release contains improvements to Melange support and a way to look for references in a whole project using Merlin and OCaml LSP.

See full changelog

Added

  • Allow libraries with the same (name ..) in projects as long as they don't conflict during resolution (via enabled_if). (#10307, @anmonteiro, @jchavarri)

  • dune describe pp now finds the exact module and the stanza it belongs to, instead of guessing the name of the preprocessed file. (#10321, @anmonteiro)

  • Print the result of dune describe pp with the respective dialect printer. (#10322, @anmonteiro)

  • Add new flag --context to dune ocaml-merlin, which allows to select a Dune context when requesting Merlin config. Add dune describe contexts subcommand. Introduce a field generate_merlin_rules for contexts declared in the workspace, that allows to optionally produce Merlin rules for other contexts besides the one selected for Merlin (#10324, @jchavarri)

  • Melange: add include paths for private library .cmj files during JS emission. (#10416, @anmonteiro)

  • dune ocaml-merlin: communicate additional directives SOURCE_ROOT, UNIT_NAME (the actual name with wrapping) and INDEX with the paths to the index(es). (#10422, @voodoos)

  • Add a new alias @ocaml-index that uses the ocaml-index binary to generate indexes that can be read by tools such as Merlin to provide project-wide references search. (#10422, @voodoos)

  • Merlin: add optional (merlin_reader CMD) construct to (dialect) stanza to configure a Merlin reader (#8567, @andreypopp)

Changed

  • Melange: treat private libraries with (package ..) as public libraries, fixing an issue where import paths were wrongly emitted. (#10415, @anmonteiro)

  • Install .glob files for Coq theories too (#10602, @ejgallego)

Fixed

  • Don't try to document nonexistent libraries in doc-new target (#10319, fixes #10056, @jonludlam)

  • Make dune-site's load_all function look for META files so that it doesn't fail on empty directories in the plugin directory (#10458, fixes #10457, @shym)

  • Fix incorrect warning for libraries defined inside nonexistant directories using (subdir ..) and used by executables using dune-build-info (#10525, @rgrinberg)

  • Don't try to take build lock when running coq top --no-build (#10547, fixes #7671, @lzy0505)

  • Make sure to truncate Dune's lock file after locking and unlocking so that users cannot observe incorrect PID's (#10575, @rgrinberg)

  • MDX: link MDX binary with byte_complete. This fixes (libraries) with foreign archives on Linux. (#10586, fixes #10582, @anmonteiro)

  • Virtual libraries: fix an issue where linking an executable involving several virtual libries would cause an error. (#10581, fixes #10460, @rgrinberg)

We are pleased to announce the release of Merlin 4.16-414 and 4.16-501.

These releases expose additional functions for packages using merlin-lib that need to manually parse merlin commands.

See full changelog
  • merlin binary
    • Addition of a merlin-lib.commands library which disassociates the execution of commands from the new_protocol, from the binary, allowing it to be invoked from other projects (ocaml/merlin#1758)
    • merlin-lib.commands: Add a find_command_opt alternative to find_command that does not raise (ocaml/merlin#1778)

We are pleased to announce the release of Merlin 4.15-414 and 4.15-501.

These releases bring a handful of bug fixes and improvements, notably to the destruct feature, that were already released for OCaml 5.2 in Merlin 5.0-502.

See full changelog
  • merlin binary
    • destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    • Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734, fixes ocaml/merlin#1661)
    • Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    • Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    • Improve cursor position detection in longidents (ocaml/merlin#1756)

Dune 3.15.3

We just released version 3.15.3 with some bug fixes.

See full changelog

Fixed

  • Fix interpretation of exists_if predicate in META files of installed libraries containing more than one element. (#10564, fixes #10563, @dbuenzli, @nojb)

  • Fix TSAN warning in wait4 stubs (#10554, fixes #10553, @emillon)

opam 2.1.5

Feedback on this post is welcomed on Discuss!

We are pleased to announce the patch release of opam 2.1.6.

This opam release consists of backported bug fixes and improvements:

  • Changes necessary for opam-repository (see ocaml/opam-repository#23789)
    • Warn if GNU patch is not detected when a patch is applied (#5893)
    • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD (#5893)
    • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch (#5893)
  • Better recognize depexts on Gentoo, NetBSD, OpenBSD (#5065)
  • Upgrade the vendored dune to 3.14.0 (#5869)
  • Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD (#5769)

Opam installation instructions (unchanged):

  1. From binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.1.6"
    

    or download manually from the Github "Releases" page to your PATH. In this case, don't forget to run opam init --reinit -ni to enable sandboxing if you had version 2.0.0~rc manually installed or to update you sandbox script.

  2. From source, using opam:

    opam update; opam install opam-devel
    

    (then copy the opam binary to your PATH as explained, and don't forget to run opam init --reinit -ni to enable sandboxing if you had version 2.0.0~rc manually installed or to update your sandbox script)

  3. From source, manually: see the instructions in the README.

We hope you enjoy this new minor version, and remain open to bug reports and suggestions.

See full changelog
  • Changes necessary for opam repository
  • Warn if GNU patch is not detected when a patch is applied [#5893 @kit-ty-kate]
  • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD [#5893 @kit-ty-kate]
  • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch [#5893 @kit-ty-kate]
  • Better recognize depexts on Gentoo, NetBSD, OpenBSD [#5065 @mndrix]
  • Upgrade the vendored dune to 3.14.0 [#5869 @kit-ty-kate]
  • Vendor mccs.1.1+17 [#5769 @kit-ty-kate]
  • Require mccs >= 1.1+17: Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD [#5769 @kit-ty-kate]
  • API Changes:
  • OpamSystem.patch now displays a warning when GNU patch is not detected and looks for both patch and gpatch as a backup option depending on the OS [#5893 @kit-ty-kate]
If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.