Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport Pexp_function from OCaml 5.2 #2544

Draft
wants to merge 66 commits into
base: main
Choose a base branch
from

Conversation

Julow
Copy link
Collaborator

@Julow Julow commented Apr 18, 2024

This is a work in progress and is required for 5.2 compatibility.

The old Pexp_function and Pexp_fun are formatted in different ways in different contextes (eg. as an argument, in a let binding, after an infix operator, etc..), which are not easy to rewrite as the AST is very different.

gpetiot and others added 30 commits January 23, 2024 11:05
TODO: Compiler libs shims are needed in Load_path and Builtin_attributes.
It already have some differences with upstream:

- The special cases of a `fun` with only newtype arguments is no longer
  rewritten by `mkfunction`.

- `(type a b)` is not desugared into `(type a) (type b)`
Rewrote the patterns 'Pexp_function cs' and 'Pexp_fun _ | Pexp_function _'.
Remaining are 'Pexp_fun' and tweaking the formatting code.
Some patterns on `Pexp_fun _` were translated into `Pexp_function _`,
which is too general.
@Julow Julow mentioned this pull request Apr 18, 2024
Julow and others added 29 commits April 19, 2024 13:39
The change in ite-fit_or_vertical.ml.ref is not a regression, it's the
same as on main.
This fixes one comment placement bug but introduce an other.
No test case could be found but it's safer that way.
This move more of the fun/function indentation code into 'fmt_function'.
One instance of '~box:false' is removed in exchange for a special case
in Params.
This requires complicated and dangerous checks. To be removed later.
and consistently in let-ops.
This brings some regressions:
- Disambiguation parentheses in case of one-liner 'function' are gone.
- Doesn't format the same way when `~box:false` (eg. rhs of a 'if then')
This removes a special case and improves ocp-indent-compat in the
janestreet profile.
Format the box_debug output as length 0 with pp_print_as and remove the
indentation in the output HTML.
This was interfering with many instances of break_unless_newline and
fits_or_breaks and caused hair loss during previous debugging sessions.
This might also contain a bug fix compared to master.
This is in a weird state, it has some useful effect but not everything was checked, and it does introduce new diffs
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.

None yet

3 participants