Skip to content

Conversation

@J494-bit
Copy link

Me gustaría probar

@J494-bit
Copy link
Author

Go

Julow and others added 24 commits July 4, 2023 11:42
* tools/preview_new_release.sh: Simplify and style changes

- Make the `-p` not optional. The default value was harmful and I was
  not happy with uncertain values being passed to `rm -rf`.

- Take URL prefixes as `-u` and `-y` instead of user names. The
  constructed URL doesn't work in every setup and is better provided
  directly.

- Build ocamlformat.

- Push the result to the fork repository.

- Arguments are quoted when needed and other style changes.

More reproducible than depending on installing it first in Opam.

* Prune some mirage projects to reduce noise

These projects have similar codebase and are maintained by a small
number of people.

* test-extra: Add ppxlib

Ppxlib has unusual code and is a good target for the tests.

* test-extra: Prune some projects

Remove owl, which was not tested, sub-libraries of core, which all have
similar code and index, which has similar code to irmin.

* tools/projects.data: Remove flow

It uses an old version of OCamlformat, the diff is too big to be useful.
It's also not upgradable automatically due to its Dune config.

* tools/projects.data: Remove owl

The project hasn't been upgraded since the removal of `align-cases` and
cannot be upgraded.
Printast fails to build since 5612a0f
These diffs were used to monitor the changes made to the parser but are
getting in the way of making more changes.
The patch files were out of sync.
* ocp-indent-compat: Don't unindent unwrapped docstrings

In ocp-indent-compat mode, the indentation of unwrapped docstrings is
based on the indentation of the first line.

This applies to the janestreet profile.
* Preserve line break between operator and let

`@@ let` used to always break while `@@ let+` used to always align.
This was changed in 913f754 to always break in both cases for
consistency.

Now, the break is preserved except in the case of a plain `let`.
Preserving the line break on `let` do not reduce the regressions with
the previous version and unecessarily give more use cases to this
unwanted feature.

This applies to `let<op>`, `let exception` and `let module`.
- Preserve the formatting of the version option, this is required by Dune.
- Update the .git-blame-ignore-revs file. This seems welcome, except in Dune where it must be disabled.
- Add tarides/ocaml-platform-installer to the list
- The list is sorted.
A let-binding can have a newtype and a coercion at the same time. This
is fixed by removing the coupling between the two.
* Restore indentation of fun arrow

This is the formatting of 0.25.1.

* Improve indent of fun args preceded by a label

The arguments must be indented more to avoid them aligning with the
`fun` and `->` in case of a break:

    let () =
      very_long_function_name
        ~very_long_argument_label:(* foo *)
          (fun
          very_long_argument_name_one
          very_long_argument_name_two
          very_long_argument_name_three
          -> () )
* 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
EmileTrotignon and others added 30 commits May 14, 2025 17:33
* fix a crash with type%e nonrec

* add attributes test

* changelog

* fmt
* showcase issue

* solve issue
This doesn't make OCamlformat able to format 5.4 code.
* Add module-indent argument

* Use module-indent option to indent structs and sigs

* Add tests for module-indent option

* Update documentation for module-indent option
* test_branch: Use `--no-comment-check`

A test case added a misplaced doc-string, causing a fatal warning and
failing `test_branch` in CI.
This passes `--no-comment-check` to ignore this error.
* Basic OCaml 5.4 support

- update vendored parsers to mirror upstream at 5.4:
  * introduce locations for Longident.t components
  * distinguish (module M:S) and ((module M):(module S)) for expressions
- support for new syntaxes:
  * bivariance
  * labelled tuples

* Add test for labeled tuples

* review: lax rule for variance annotation

* review: test comments inside tuple types

* review: track labels locations in tuple types

* Locations for labels

* Concrete node for tuple element punning
* parser-standard: Reduce diffs with upstream

Promote small differences that do not change the parser's behavior to
parser-standard.
This will make future updates easier.

* parser-extended: Reduce diffs with parser-standard

This slightly reduce the difference between the two vendored parser in
the hope of making the future update easier.
* Bin_conf: don't pass info to update_using_cmdline

There is only a single instance anyway.

* Bin_conf: parse cmdline only once and cache result

Otherwise the config parser would run for every argument, resulting in
quadratic parsing.
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>
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