Skip to content

ppx_devtools.optcomp: gate patterns in the cases of a function - #2

Merged
hhugo merged 1 commit into
mainfrom
optcomp-function-cases
Oct 27, 2026
Merged

hhugo merged 1 commit into
mainfrom
optcomp-function-cases

Conversation

@vouillon

Copy link
Copy Markdown
Member

With OxCaml's ppxlib, the cases of a function are mapped with self#list self#case rather than self#cases, so the @if attributes on their patterns were not evaluated. Gated cases are now dropped from [case], by raising an exception caught in list. Matching on Pfunction_cases directly is not an option, as it does not exist in ppxlib before 0.36.

With OxCaml's ppxlib, the cases of a function are mapped with
[self#list self#case] rather than [self#cases], so the [@if] attributes
on their patterns were not evaluated. Gated cases are now dropped from
[case], by raising an exception caught in [list]. Matching on
[Pfunction_cases] directly is not an option, as it does not exist in
ppxlib before 0.36.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vouillon
vouillon requested a review from hhugo October 27, 2026 12:24
@hhugo
hhugo merged commit 000d003 into main Oct 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants