Skip to content

Conversation

@J494-bit
Copy link

Me gustaría probar

@J494-bit
Copy link
Author

Go

Julow and others added 24 commits June 27, 2023 16:26
In `wrap-docstrings=false` mode, the uneeded box around code spans cause
a break.
A floating doc being the first item of a class type would have an
extraneous newline before them.

Floating docs in other position would cause the indentation of the class
type to be increased by one.
The new syntax rewrite introduced in #2282 is not compatible with 4.02.

The default value for the `ocaml-version` option is 4.04 but users are
still supporting OCaml 4.02.

`test/passing/tests/record-402.ml.ref` parse on 4.02.
`test/passing/tests/record.ml.ref` parse on 4.03.

The tests that are specifically about the newer syntax are moved into an
other test.

* Merge tests `record_identity` and `record_punning`
* 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.
EmileTrotignon and others added 30 commits April 29, 2025 10:10
* promote ocp docking ofr infix apply.

* fmt

* changelog
* fix crash with inline record type variable

* update changelog

* promote tests
* fix: handle case where doc does not lex as ocaml

Fixes #2679

Formatting `mld` files can crash when the input file cannot be lexed as
ocaml. This can happen with LaTeX is found in `{m ...}` or C code in
`{@c[ ... ]}`, for example.

In that case we would crash when building the list of tokens in the
file; however it's not used in the `mld` case.
* 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
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.