-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not use ghost locations for type constraints (ocaml#10555) #1779
Conversation
| Some t, Some r -> | ||
if type_first then field_space $ fmt_type t $ fmt "@ " $ fmt_rhs r | ||
else | ||
| Some t, Some r -> ( | ||
match constraint_loc with | ||
| Some (`Constraint_lid loc) -> | ||
field_space | ||
$ Cmts.fmt_before c loc ~pro:(Fmt.break 1 0) ~epi:noop | ||
$ fmt_type t $ fmt "@ " $ fmt_rhs r $ Cmts.fmt_after c loc | ||
| Some (`Constraint_exp loc) -> | ||
field_space $ fmt "=@;<1 2>" | ||
$ hvbox 0 | ||
@@ Cmts.fmt c loc | ||
(str "(" $ cbox 0 r $ str " " $ fmt_type ~parens:true t) | ||
| None -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because ocaml/ocaml#10555 also changed the location span used for Ppat_constraint/Pexp_constraint, so the formatting had to be updated accordingly.
Otherwise here is the diff I had:
let _ =
{ (* a *) a (* a' *)= (* b *) b (* b' *)
- ; (* c' *) (* c *) c: (* d *) d (* d' *) = (* e *) e (* e' *)
+ ; (* c' *)
+ (* c *) c: (* d *) d (* d' *) = (* e *) e
+ (* e' *)
; (* f *) f (* f' *)
; (* j *)
(* g *) g (* g' *)= ((* h *) h (* h' *) : (* i *) i (* i' *))
(* j' *) }
let { (* a *) a (* a' *)= (* b *) b (* b' *)
- ; (* c' *) (* c *) c: (* d *) d (* d' *) = (* e *) e (* e' *)
+ ; (* c' *)
+ (* c *) c: (* d *) d (* d' *) = (* e *) e
+ (* e' *)
; (* f *) f (* f' *)
; (* j *)
(* g *) g (* g' *)= ((* h *) h (* h' *) : (* i *) i (* i' *))
(the previous formatting was not 100% correct by the way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :)
Applying ocaml/ocaml#10555
No diff with test_branch.sh, the changes in comments_in_record.ml are a fix.