Skip to content

Js#11

Open
J494-bit wants to merge 667 commits intofacebook-github-bot:mainfrom
ocaml-ppx:main
Open

Js#11
J494-bit wants to merge 667 commits intofacebook-github-bot:mainfrom
ocaml-ppx:main

Conversation

@J494-bit
Copy link

Me gustaría probar

@J494-bit
Copy link
Author

Go

Julow and others added 24 commits July 18, 2023 15:02
* Editorialize the changelog

- Non-bug entries are moved to the "Changes" section.
- Lists are sorted by PR number.
- Similar entries are merged.
- Spelling is improved

* Bump version numbers

* Mark breaking changes in the changelog with `*`
* Update the release procedure

Missing mention of ocamlformat-lib.

* Move the comment in ocamlformat.opam.template

At the previous position, dune-release would generate more fields just
before it, moving it to an unrelated place.

* CHANGES: Standalone '*' that renders in HTML

The previous idea was not working when the markdown was rendered by
Github as every items were rendered the same.

The syntax is a bit heavier in plain text but making these changes more
visible doesn't hurt.

* CI: Fix Windows release build

- Use setup-ocaml instead of installing Opam from scratch.
  Removes calls to the cygwin installer.

- Move scripts into the action file.
  Allows building for past releases.
  The script is now small enough to embed.
instead of the extended parser (the default).
The special formatting of a begin-end in a match case was dropping
attributes.
* Add a Roadmap
* Add authors and maintainers information
* Improve Contributing Guide and README
* Convert Hacking guide to Markdown
* Rename LICENSE
* Update Changelog tags
* Add description of the project in opam file
* Remove outdated bash completion for test_branch

Co-authored-by: Guillaume Petiot <guillaume@tarides.com>
Co-authored-by: Jules Aguillon <jules@j3s.fr>
* Test wrapping class arrow type

Test both break-separators to before and after.

* Separate `fmt_arrow_type`

The plan is to re-use it to format class types arrows.
Some cleanup.

* Consistent formatting for arrow class types

Use the same indentation and breaks for arrows in class types as for
arrows in core types.
The main challenge is that class types contain class signatures, which
are docked after an arrow.

The `fmt_class_type` is rewritten in the "pro" style, which also remove unnecessary space in object poly types
* vendored parsers: Backport dead-code as comments

Dead code in parser-extended have been removed in the past. I reverted that
and commented it out instead. This makes the code more similar with
parser-standard and helps recognize new code from previously removed
code.

* Backport 5.1 error printing code

This slightly change some error messages.
* Backport 5.1.0-beta1 standard parser changes

- New `Pmod_apply_unit` module type constructor.

- New `value_constraint` field in value bindings.
  This makes the parser less permissive about bugs in the formatting of
  type annotation on let-bindings.

- Some changes in `Location` and `Ast_mapper` are not necessary but are
  backported to reduce the diff.

- String assignment operator has been removed upstream but remains
  supported by commenting out the change.

* Backport Pmod_apply_unit to extended AST

The extended AST already had a similar constructor.
This is just a rename.

* Backport value_binding change to parser-extended

We already had a similar AST node but the `value_constraint` field is
new and helps removing complex code in Sugar.

The `pvb_is_pun` field is kept from the previous extended representation.

* parser-extended: Rename 'let_bindings' to 'value_bindings'

For consistency with the new 'value_binding'.
* De-indent the `object` keyword in class types

The previous indentation of the keyword was ambiguous as it was aligned
with the previous and next lines.

This is similar to the formatting of module `struct`.

* Ensure comments, doc, attrs and parens are formatted for class types
A comment just before a constructor in a type declaration was causing
the argument of the constructor to be formatted in vertical style.

The constructor is now formatted the same as if there were no comment.
* test_branch: Print tested versions

When looking at the diffs on Github, it can be reassuring to see that
the versions being tested are right.

* Don't checkout the merge commit
Improve ocp-indent-compat for many nodes:

* `fun` and `function` expressions
* Doc in record and variant declarations
* Pexp_constraint
* Module expr constraint
* Pmty_with
* Indent wrapping type constrs
* Assignment operators
* Annotation of module unpack
* Fun arguments (The box structure needs to be tweaked)

Added the `Params.Indent` module for keeping these functions together.
* Make sure not to break out-of-margin emtpy-sig
* preview_new_release: Remove alcotest and tezos

* preview_new_release: Option to apply a previous version first

An executable can be passed to the new `-b` option, it will be applied
in a first pass and the result will be commited.

This ensures that the preview commit shows only the diff caused by the
new version.
EmileTrotignon and others added 30 commits October 14, 2025 15:17
Set 'TERM=dumb' to workaround unstable output from Cmdliner
Cmdliner output makes the tests unstable and cf3d2e7 did not fix the
issue. For example, the lower-bounds test in ocaml-ci fails.
* Fix precedence of tuples with labels

It was formatting:

    let labeled_tuple () = ~x:1, ~y:(1 + 2)

into:

    let labeled_tuple () = ~x:1, ~y:1 + 2

* Update CHANGES
* Fix dropped comment in 'if then begin .. end'

* Update CHANGES
* add test showcasing issue

* fix issue

* promote test
* Add configuration to control whether let-punning is used

* Add tests for let punning configuration

* Update manpage in documentation

* CHANGES entry

* Rename to letop-punning

* More documentation with example

* Fix CHANGES
* Fix redundancy in letop-punning tests

* Notes on adding a test in CONTRIBUTING

* CHANGES entry

* Edits per @EmileTrotignon

* Typo repair

* Edits per @Julow
* letop-punning for extension nodes

* Update CHANGES.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix comments getting dropped by letop-punning=always

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Currently, Cmdliner is given a formatter that drops any text, but Cmdliner can (and
does) print whitespace via the non-overridden out_spaces, out_indent and out_newlines.
These locations, which are new in 5.4, are sometimes traversed (e.g. Pexp_setfield) and
sometimes not (e.g. Pexp_field). So clearly a bug.

The fix is concretely:

- change map_loc to map over both fields `{ loc; txt }` of `Location.loc`
- propagate the change, ie change `map_loc` to `map_string_loc`,
  `map_string_opt_loc` or `map_loc_lid` depending on the type. All occurrences
  of the latter are bug fixes.
* Support the new functor type syntax `MT -> MT`

Support the unnamed functor parameters in module types:

    module type F = ARG -> S

The extended parser is changed to preserve the concrete syntax of
functor arguments in module types. Notably, these three lines are no
longer equivalent and the first two are no longer turned into the third:

    module M : (_ : S) -> (_ : S) -> S = N
    module M : S -> S -> S = N
    module M : (_ : S) (_ : S) -> S = N
Update to the new Odoc features:
- @toc_status and @order_category
- Structured code block tags syntax
- Indentation of code and verbatim blocks

Also backported formatting changes and code changes.

* odoc-parser: Code block and verbatim blocks indentation change

Odoc now strips the indentation from code and verbatim blocks. It
doesn't use the indentation of the least indented line, like
OCamlformat, but instead use the indentation of the block opening.

* odoc: Normalize `\\n` into newline

In code blocks, newlines can be turned into `\\n` (or the opposite) when
formatting string literals that need to break. Update the normalization
function to avoid crashing when that happens.

* odoc: Remove extra indentation in code blocks

The updated Odoc parser considers that code blocks horizontally start at
the opening bracket. It no longer uses the indentation of the least
indented line for that.
As a result, OCamlformat cannot indent code blocks without changing
their content.

The indentation is also removed in code blocks that are formatted, to
avoid adding visible indentation in rendered documentation.

* odoc: Don't fail for removed whitespaces in code blocks

During normalisation, allow whitespaces to disappear from code blocks.
This happens when code if formatted.
* Missing parens in module type `(M with type ..) -> N`

Fix the parenthesing rules for `with type` inside functors and functors
inside `with type`.

* Fix short-syntax functor formatting
* use special case beginend syntax in match cases when possible

* also allow `if then begin match`

* changelog

* changelog

* fmt
Co-authored-by: Jules Aguillon <jules@j3s.fr>
* parser-std: Backport polymorphic paramters

From ocaml/ocaml#13806

* parser-ext: Backport polymorphic parameters

* Fix Ast rules for Ptyp_poly

It is treated with the same precedence as Ptyp_arrow.
* parser-std: Backport Ppat_unpack

Also backport the `map_loc` change in `Ast_mapper`.

* parser-ext: Backport Ppat_unpack

We already did a similar change in the past, the parsetree doesn't
change.

* parser-ext: Backport Ast_mapper map_loc changes

* Disable rewriting rule for Ppat_unpack

It is no longer valid to rewrite:

    ((module M) : (module S))

into:

    (module M : S)
The original string syntax (eg. `{del| .. |del}`) is not respected
because this is probably unecessary.
An minimal unsafe version of Domain.DLS is used to implement Format_.
This shim module just needs to be removed if OCamlformat ever use
parallelism.

* Disable scan_push bug fix

This bug fix breaks OCamlformat and will be fixed in a separate PR.
Improve the formatting of:

    module type of M
      with module A = A (*test*)
`Pexp_struct_item` replaces `Pexp_letexception`, `Pexp_letmodule` and
`Pexp_letopen`. The code for the old constructs is removed and replaced
by a call to `fmt_structure_item`.

The code for formatting structure items is changed to propagate the
`~pro` and `~epi` arguments.

* Extend the context for embedded struct items

The `Str_exp` context is needed to apply the `let_module` option. The
`Mb` context constructor is extended to carry the parent context, which
would otherwise be erased before `fmt_module` gets called.
Backport modular explicits syntax.
The test code is taken from the compiler's testsuite.

* Factorize the formatting of package types

This removes code with seamingly no regressions.
Backport refactors and other changes made upstream that do not change the language syntax. The goal is to reduce the diff with upstream to make future updates easier.

* Reduce diff in arg_label

The location is different but no comment moved in the tests.
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.

10 participants