-
Notifications
You must be signed in to change notification settings - Fork 167
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
Julow
wants to merge
66
commits into
ocaml-ppx:main
Choose a base branch
from
Julow:backport-52-extended
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Closed
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.
In a hacky 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.
…nto backport-52-extended
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work in progress and is required for 5.2 compatibility.
The old
Pexp_function
andPexp_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.