Skip to content

Fix ';;' formatting between doc-comments and toplevel directives#2432

Merged
Julow merged 5 commits intoocaml-ppx:mainfrom
gpetiot:docstrings_toplevel_directives
Sep 15, 2023
Merged

Fix ';;' formatting between doc-comments and toplevel directives#2432
Julow merged 5 commits intoocaml-ppx:mainfrom
gpetiot:docstrings_toplevel_directives

Conversation

@gpetiot
Copy link
Copy Markdown
Collaborator

@gpetiot gpetiot commented Sep 13, 2023

Fix #2407

@gpetiot gpetiot requested a review from Julow September 13, 2023 17:13
Comment thread CHANGES.md Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment thread CHANGES.md Outdated
Comment thread lib/Fmt_ast.ml Outdated
| _, Some (`Item {pstr_desc= Pstr_eval _; _}, _) -> true
| ( `Item {pstr_desc= Pstr_eval _; _}
, Some (`Item {pstr_desc= Pstr_attribute _; _}, _) ) ->
true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no ;; here:

x + 1

let y = 2

Is it really needed here ?

x + 1;;

(** foo *)

let y = 2

The diffs in test_branch seems to indicate that no.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the regressions, let me know what you think.

gpetiot and others added 3 commits September 14, 2023 13:26
Co-authored-by: Jules Aguillon <jules@j3s.fr>

let two = 2

[@@@warning "-labels-omitted"] ;;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ;; seems unnecessary as well ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently it is, I get a syntax error from the compiler if I remove them.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is! Sorry about that.

Copy link
Copy Markdown
Collaborator

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :) Let's merge this before the release!

@Julow Julow merged commit 253323e into ocaml-ppx:main Sep 15, 2023
@gpetiot gpetiot deleted the docstrings_toplevel_directives branch September 15, 2023 09:15
Julow added a commit to Julow/opam-repository that referenced this pull request Sep 15, 2023
….26.1)

CHANGES:

### Changed

- Compatible with OCaml 5.1.0 (ocaml-ppx/ocamlformat#2412, @Julow)
  The syntax of let-bindings changed sligthly in this version.
- Improved ocp-indent compatibility (ocaml-ppx/ocamlformat#2428, @Julow)
- \* Removed extra break in constructor declaration with comment (ocaml-ppx/ocamlformat#2429, @Julow)
- \* De-indent the `object` keyword in class types (ocaml-ppx/ocamlformat#2425, @Julow)
- \* Consistent formatting of arrows in class types (ocaml-ppx/ocamlformat#2422, @Julow)

### Fixed

- Fix dropped attributes on a begin-end in a match case (ocaml-ppx/ocamlformat#2421, @Julow)
- Fix dropped attributes on begin-end in an if-then-else branch (ocaml-ppx/ocamlformat#2436, @gpetiot)
- Fix non-stabilizing comments before a functor type argument (ocaml-ppx/ocamlformat#2420, @Julow)
- Fix crash caused by module types with nested `with module` (ocaml-ppx/ocamlformat#2419, @Julow)
- Fix ';;' formatting between doc-comments and toplevel directives (ocaml-ppx/ocamlformat#2432, @gpetiot)
nberth pushed a commit to nberth/opam-repository that referenced this pull request Jun 18, 2024
….26.1)

CHANGES:

### Changed

- Compatible with OCaml 5.1.0 (ocaml-ppx/ocamlformat#2412, @Julow)
  The syntax of let-bindings changed sligthly in this version.
- Improved ocp-indent compatibility (ocaml-ppx/ocamlformat#2428, @Julow)
- \* Removed extra break in constructor declaration with comment (ocaml-ppx/ocamlformat#2429, @Julow)
- \* De-indent the `object` keyword in class types (ocaml-ppx/ocamlformat#2425, @Julow)
- \* Consistent formatting of arrows in class types (ocaml-ppx/ocamlformat#2422, @Julow)

### Fixed

- Fix dropped attributes on a begin-end in a match case (ocaml-ppx/ocamlformat#2421, @Julow)
- Fix dropped attributes on begin-end in an if-then-else branch (ocaml-ppx/ocamlformat#2436, @gpetiot)
- Fix non-stabilizing comments before a functor type argument (ocaml-ppx/ocamlformat#2420, @Julow)
- Fix crash caused by module types with nested `with module` (ocaml-ppx/ocamlformat#2419, @Julow)
- Fix ';;' formatting between doc-comments and toplevel directives (ocaml-ppx/ocamlformat#2432, @gpetiot)
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.

Bug: bad interaction between doc comments and toplevel directives

2 participants