Skip to content
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

Fix parenthesing of let in class expressions #2599

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ profile. This started with version 0.26.0.
- Display `a##b` instead of `a ## b` and similarly for operators that start with # (#2580, @v-gb)
- \* Fix arrow type indentation with `break-separators=before` (#2598, @Julow)
- Fix formatting of short `fun` expressions with the janestreet profile (#2593, @Julow)
- Fix missing parentheses around a let in class expressions (#2599, @Julow)

### Changes
- The location of attributes for structure items is now tracked and preserved. (#2247, @EmileTrotignon)
Expand Down
1 change: 1 addition & 0 deletions lib/Ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,7 @@ end = struct
match c.pcl_desc with
| Pcl_apply _ -> Some Apply
| Pcl_structure _ -> Some Apply
| Pcl_let _ -> Some Low
| _ -> None )
| Top | Pat _ | Mty _ | Mod _ | Sig _ | Str _ | Tli _ | Clf _ | Ctf _
|Rep | Mb _ | Md _ | Cd _ | Ctd _ ->
Expand Down
5 changes: 5 additions & 0 deletions test/passing/tests/class_expr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ class c =
let pci_params = self#list in
()
end

class c =
(let () = print_endline "Class init" in
with_param )
()
Loading