Skip to content

Repro case for loading too many rules for @fmt - #16364

Open
Leonidas-from-XIV wants to merge 1 commit into
ocaml:mainfrom
Leonidas-from-XIV:fmt-cram-repro
Open

Leonidas-from-XIV wants to merge 1 commit into
ocaml:mainfrom
Leonidas-from-XIV:fmt-cram-repro

Conversation

@Leonidas-from-XIV

Copy link
Copy Markdown
Member

When doing dune build @fmt Dune loads the rules and, given the package does not exist fails to evaluate the pform. However in the case of cram stanzas, there's no need to evaluate these pforms as the result should not matter for formatting.

Originally reported by @jonludlam in ocaml/odoc#1490

Signed-off-by: Marek Kubica <marek@tarides.com>
@Alizter

Alizter commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Maybe what's needed here is some sort of %{pkg-available:..} so it can properly guard the version check?

@Leonidas-from-XIV

Copy link
Copy Markdown
Member Author

Maybe. I was also wondering whether it would make sense to coerce evaluation failures in if_available to false, though that has a bit of a risk to hide issues with typos and thus never trigger at all.

@Alizter

Alizter commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

The issue with the cram stanza is that we need to interpret the enabled_if as early as possible. It can potentially contribute to the fmt alias by using the aliases field for instance. Other than guarding enabled_if with some proper thing I don't see how we could support this.

I'll note that I haven't thought through what pkg-available will entail, and so its just an idea. In the meantime, you could get away with bin-available or lib-available from the package in question to guard the expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants