Skip to content

Commit 30ac028

Browse files
authored
Merge branch 'main' into mld-lexing-errors
2 parents 941e891 + 1866147 commit 30ac028

File tree

797 files changed

+48627
-2123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

797 files changed

+48627
-2123
lines changed

.github/workflows/build-dune.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Build on Dune PM
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
runs-on: [ ubuntu-latest, macos-latest ]
10+
runs-on: ${{ matrix.runs-on }}
11+
continue-on-error: true
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Use dune
17+
uses: ocaml-dune/[email protected]
18+
with:
19+
automagic: true

.github/workflows/changelog-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ on:
88
jobs:
99
Changelog-Entry-Check:
1010
name: Check Changelog Action
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1212
steps:
1313
- uses: tarides/changelog-check-action@v1

.github/workflows/pr-number.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ on: [pull_request_target]
55
jobs:
66
PR-Number-Update:
77
name: Update PR number
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99
steps:
1010
- uses: tarides/[email protected]

CHANGES.md

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ profile. This started with version 0.26.0.
66

77
## unreleased
88

9+
### Deprecated
10+
11+
- Starting in this release, ocamlformat can use cmdliner >= 2.0.0. When that is
12+
the case, the tool no longer accepts unambiguous option names prefixes. For
13+
example, `--max-iter` is not accepted anymore, you have to pass the full
14+
option `--max-iters`. This does not apply to the keys in the `.ocamlformat`
15+
configuration files, which have always required the full name.
16+
See dbuenzli/cmdliner#200.
17+
(#2680, @emillon)
18+
919
### Fixed
1020

1121
- Fixed `wrap-comments=true` not working with the janestreet profile (#2645, @Julow)
@@ -33,13 +43,47 @@ profile. This started with version 0.26.0.
3343

3444
- Fix crash due to edge case with asterisk-prefixed comments (#2674, @Julow)
3545

46+
3647
- Fix crash when formatting `mld` files that cannot be lexed as ocaml (e.g.
3748
containing LaTeX or C code) (#2684, @emillon)
49+
50+
- \* Fix double parens around module constraint in functor application :
51+
`module M = F ((A : T))` becomes `module M = F (A : T)`. (#2678, @EmileTrotignon)
52+
53+
- Fix misplaced `;;` due to interaction with floating doc comments.
54+
(#2691, @EmileTrotignon)
55+
56+
- The formatting of attributes of expression is now aware of the attributes
57+
infix or postix positions: `((fun [@a] x -> y) [@b])` is formatted without
58+
moving attributes. (#2676, @EmileTrotignon)
59+
60+
- `begin%e ... end` and `begin [@a] ... end` nodes are always preserved.
61+
(#2676, @EmileTrotignon)
62+
63+
- `begin end` syntax for `()` is now preserved. (#2676, @EmileTrotignon)
64+
65+
- \* The formatting of infix extensions is now consistent with regular
66+
formatting by construction. This reduces indentation in `f @@ match%e`
67+
expressions to the level of indentation in `f @@ match`. Other unknown
68+
inconsistencies might also be fixed. (#2676, @EmileTrotignon)
69+
70+
- \* The spacing of infix attributes is now consistent across keywords. Every
71+
keyword but `begin` `function`, and `fun` had attributes stuck to the keyword:
72+
`match[@a]`, but `fun [@a]`. Now its also `fun[@a]`. (#2676, @EmileTrotignon)
73+
74+
- \* The formatting of`let a = b in fun ...` is now consistent with other
75+
contexts like `a ; fun ...`. A check for the syntax `let a = fun ... in ...`
76+
was made more precise. (#2705, @EmileTrotignon)
77+
78+
- Fix a crash on `type 'a t = A : 'a. {a: 'a} -> 'a t`. (#2710, @EmileTrotignon)
79+
3880
### Changed
3981

40-
- `begin if`, `lazy begin`, `begin match` and `begin fun` can now be printed on
41-
the same line, with one less indentation level for the body of the inner
42-
expression. (#2664, #2666, #2671, #2672, @EmileTrotignon) For example :
82+
- `|> begin`, `~arg:begin`, `begin if`, `lazy begin`, `begin match`,
83+
`begin fun` and `map li begin fun` can now be printed on the same line, with
84+
one less indentation level for the body of the inner expression.
85+
(#2664, #2666, #2671, #2672, #2681, #2685, #2693, @EmileTrotignon)
86+
For example :
4387
```ocaml
4488
(* before *)
4589
begin
@@ -52,6 +96,36 @@ profile. This started with version 0.26.0.
5296
end
5397
```
5498

99+
- \* `break-struct=natural` now also applies to `sig ... end`. (#2682, @EmileTrotignon)
100+
101+
- \* `;;` is added at the of every toplevel-expression, except if its the last
102+
thing in the struct (#2683, @EmileTrotignon) For example:
103+
```ocaml
104+
(* before *)
105+
print_endline "foo"
106+
let a = 3
107+
108+
(* after *)
109+
print_endline "foo" ;;
110+
let a = 3
111+
```
112+
113+
- \* Infix apply docking behaviour from --ocp-indent-compat is promoted to
114+
everyone. The most common effect is that `|> map (fun` is now indented from
115+
`|>` and not from `map`:
116+
```ocaml
117+
(* before *)
118+
v
119+
|>>>>>> map (fun x ->
120+
x )
121+
(* after *)
122+
v
123+
|>>>>>> map (fun x ->
124+
x )
125+
```
126+
`@@ match` can now also be on one line.
127+
(#2694, @EmileTrotignon)
128+
55129
## 0.27.0
56130

57131
### Highlight

bench/bench.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ let json_of_ols_results ?name (results : Bechamel.Analyze.OLS.t results) :
9797
let results =
9898
metrics_by_test |> Hashtbl.to_seq
9999
|> Seq.map (fun (test_name, metrics) ->
100-
let metrics =
101-
metrics |> Hashtbl.to_seq
102-
|> Seq.map (fun (metric_name, ols) ->
103-
(metric_name, json_of_ols ols) )
104-
|> List.of_seq
105-
|> fun bindings -> `Assoc bindings
106-
in
107-
`Assoc [("name", `String test_name); ("metrics", metrics)] )
100+
let metrics =
101+
metrics |> Hashtbl.to_seq
102+
|> Seq.map (fun (metric_name, ols) ->
103+
(metric_name, json_of_ols ols) )
104+
|> List.of_seq
105+
|> fun bindings -> `Assoc bindings
106+
in
107+
`Assoc [("name", `String test_name); ("metrics", metrics)] )
108108
|> List.of_seq
109109
|> fun items -> `List items
110110
in

bin/ocamlformat/main.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ open Ocamlformat_format ;;
1616

1717
Stdlib.at_exit (Format.pp_print_flush Format.err_formatter) ;;
1818

19-
Stdlib.at_exit (Format_.pp_print_flush Format_.err_formatter)
19+
Stdlib.at_exit (Format_.pp_print_flush Format_.err_formatter) ;;
2020

2121
let format ?output_file ~kind ~input_name ~source (conf : Conf.t) =
2222
if conf.opr_opts.disable.v then Ok source

doc/manpage_ocamlformat.mld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ OPTIONS (CODE FORMATTING STYLE)
130130
expanded. The default value is auto.
131131

132132
--break-struct={force|natural}
133-
Break struct-end module items. force will break struct-end phrases
134-
unconditionally. natural will break struct-end phrases naturally
135-
at the margin. The default value is force.
133+
Break struct-end and sig-end items. force will break items
134+
unconditionally. natural will break items naturally at the margin.
135+
The default value is force.
136136

137137
--cases-exp-indent=COLS
138138
Indentation of cases expressions (COLS columns). See also the

0 commit comments

Comments
 (0)