Skip to content

Fix unstable comment in variant decl#1108

Merged
Julow merged 5 commits intoocaml-ppx:masterfrom
Julow:unstable-cmt-variant-decl
Nov 12, 2019
Merged

Fix unstable comment in variant decl#1108
Julow merged 5 commits intoocaml-ppx:masterfrom
Julow:unstable-cmt-variant-decl

Conversation

@Julow
Copy link
Copy Markdown
Collaborator

@Julow Julow commented Oct 29, 2019

Fix #989

There is a regression:

Surprisingly, it appears only once with test_branch

-type blabla = Constr_a (* constr a *) | Constr_b
+type blabla =
+  | Constr_a
+  (* constr a *)
+  | Constr_b

The example from the issue formats badly, but that's unrelated:

 and b =
   | A (* A *)
   | B (* B *)
-    (* C ? *)
-  | D (* D *)
-    (* E *)
+  (* C ? *)
+  | D
+
+(* D *)
+(* E *)

@facebook-github-bot
Copy link
Copy Markdown

Hi Julow! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@Julow Julow force-pushed the unstable-cmt-variant-decl branch from b0252de to 1d2c865 Compare October 29, 2019 16:01
@gpetiot
Copy link
Copy Markdown
Collaborator

gpetiot commented Oct 30, 2019

I tried to improve the formatting without success, I think it's acceptable to break whenever there are comments.

@emillon
Copy link
Copy Markdown
Collaborator

emillon commented Oct 30, 2019

Yes, breaking seems fine. This does not affect (** *) comments, right?

@Julow
Copy link
Copy Markdown
Collaborator Author

Julow commented Oct 30, 2019

Yes, breaking seems fine. This does not affect (** *) comments, right?

It doesn't.

@Julow Julow force-pushed the unstable-cmt-variant-decl branch from 1d2c865 to da01110 Compare November 6, 2019 13:01
@Julow
Copy link
Copy Markdown
Collaborator Author

Julow commented Nov 6, 2019

Just rebased. Should we merge ?

@Julow Julow force-pushed the unstable-cmt-variant-decl branch from da01110 to 02c1c41 Compare November 6, 2019 15:50
@Julow Julow force-pushed the unstable-cmt-variant-decl branch from 2829dc8 to ab60427 Compare November 12, 2019 17:04
@Julow Julow merged commit 8943c45 into ocaml-ppx:master Nov 12, 2019
Julow added a commit to Julow/opam-repository that referenced this pull request Jan 28, 2020
CHANGES:

#### New features

  + Add an option `--margin-check` to emit a warning if the formatted output exceeds the margin (ocaml-ppx/ocamlformat#1110) (Guillaume Petiot)
  + Preserve comment indentation when `wrap-comments` is unset (ocaml-ppx/ocamlformat#1138, ocaml-ppx/ocamlformat#1159) (Jules Aguillon)
  + Improve error messages (ocaml-ppx/ocamlformat#1147) (Jules Aguillon)
  + Display standard output in the emacs plugin even when ocamlformat does not fail (ocaml-ppx/ocamlformat#1189) (Guillaume Petiot)

#### Removed

  + Remove `ocamlformat_reason` (ocaml-ppx/ocamlformat#254, ocaml-ppx/ocamlformat#1185) (Etienne Millon).
    This tool has never been released to opam, has no known users, and overlaps
    with what `refmt` can do.
  + Remove `ocamlformat-diff` (ocaml-ppx/ocamlformat#1205) (Guillaume Petiot)
    This tool has never been released to opam, has no known users, and overlaps
    with what `merge-fmt` can do.

#### Packaging

  + Work with base v0.13.0 (ocaml-ppx/ocamlformat#1163) (Jules Aguillon)

#### Bug fixes

  + Fix placement of comments just before a '|' (ocaml-ppx/ocamlformat#1203) (Jules Aguillon)
  + Fix build version detection when building in the absence of a git root (ocaml-ppx/ocamlformat#1198) (Anil Madhavapeddy)
  + Fix wrapping of or-patterns in presence of comments with `break-cases=fit` (ocaml-ppx/ocamlformat#1167) (Jules Aguillon)
    This also fixes an unstable comment bug in or-patterns
  + Fix an unstable comment bug in variant declarations (ocaml-ppx/ocamlformat#1108) (Jules Aguillon)
  + Fix: break multiline comments (ocaml-ppx/ocamlformat#1122) (Guillaume Petiot)
  + Fix: types on named arguments were wrapped incorrectly when preceding comments (ocaml-ppx/ocamlformat#1124) (Guillaume Petiot)
  + Fix the indentation produced by max-indent (ocaml-ppx/ocamlformat#1118) (Guillaume Petiot)
  + Fix break after Psig_include depending on presence of docstring (ocaml-ppx/ocamlformat#1125) (Guillaume Petiot)
  + Remove some calls to if_newline and break_unless_newline and fix break before closing brackets (ocaml-ppx/ocamlformat#1168) (Guillaume Petiot)
  + Fix unstable cmt in or-pattern (ocaml-ppx/ocamlformat#1173) (Guillaume Petiot)
  + Fix location of comment attached to the underscore of an open record (ocaml-ppx/ocamlformat#1208) (Guillaume Petiot)
  + Fix parentheses around optional module parameter (ocaml-ppx/ocamlformat#1212) (Christian Barcenas)
  + Fix grouping of horizontally aligned comments (ocaml-ppx/ocamlformat#1209) (Guillaume Petiot)
  + Fix dropped comments around module pack expressions (ocaml-ppx/ocamlformat#1214) (Jules Aguillon)
  + Fix regression of comment position in list patterns (ocaml-ppx/ocamlformat#1141) (Josh Berdine)
  + Fix: adjust definition of Location.is_single_line to reflect margin (ocaml-ppx/ocamlformat#1102) (Josh Berdine)

#### Documentation

  + Fix documentation of option `version-check` (ocaml-ppx/ocamlformat#1135) (Wilfred Hughes)
  + Fix hint when using `break-separators=after-and-docked` (ocaml-ppx/ocamlformat#1130) (Greta Yorsh)
bogdan2412 pushed a commit to bogdan2412/ocamlformat that referenced this pull request Mar 28, 2020
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: Unstable comment in variant decl

4 participants