Skip to content

Commit 86f8112

Browse files
ocaml version is set to 5.4.0 by default to allow effects (#2750)
Co-authored-by: Jules Aguillon <jules@j3s.fr>
1 parent 0a805f2 commit 86f8112

26 files changed

+83
-82
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ profile. This started with version 0.26.0.
100100
end
101101
```
102102

103+
- \* Set the `ocaml-version` to `5.4` by default (#2750, @EmileTrotignon)
104+
The main difference is that the `effect` keyword is recognized without having
105+
to add `ocaml-version=5.3` to the configuration.
106+
In exchange, code that use `effect` as an identifier must use
107+
`ocaml-version=5.2`.
108+
103109
## 0.28.1
104110

105111
### Highlight

doc/manpage_ocamlformat.mld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,7 @@ OPTIONS
626626
omitted.
627627

628628
--ocaml-version=V
629-
Version of OCaml syntax of the output. The default value is
630-
4.04.0.
629+
Version of OCaml syntax of the output. The default value is 5.4.0.
631630

632631
--ocp-indent-config
633632
Read .ocp-indent configuration files. base is an alias for

lib/Conf.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ let default =
266266
; disable= elt false
267267
; margin_check= elt false
268268
; max_iters= elt 10
269-
; ocaml_version= elt Ocaml_version.Releases.v4_04_0
269+
; ocaml_version= elt (Ocaml_version.v ~patch:0 5 4)
270270
; quiet= elt false
271271
; disable_conf_attrs= elt false
272272
; version_check= elt true } }

test/cli/print_config.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ No redundant values:
1818
disable=false
1919
margin-check=false
2020
max-iters=10
21-
ocaml-version=4.04.0
21+
ocaml-version=5.4.0
2222
quiet=false
2323
disable-conf-attrs=false
2424
version-check=true
@@ -99,7 +99,7 @@ Redundant values from the conventional profile:
9999
disable=false
100100
margin-check=false
101101
max-iters=10
102-
ocaml-version=4.04.0
102+
ocaml-version=5.4.0
103103
quiet=false
104104
disable-conf-attrs=false
105105
version-check=true
@@ -180,7 +180,7 @@ Redundant values from the ocamlformat profile:
180180
disable=false
181181
margin-check=false
182182
max-iters=10
183-
ocaml-version=4.04.0
183+
ocaml-version=5.4.0
184184
quiet=false
185185
disable-conf-attrs=false
186186
version-check=true

test/passing/gen/dune.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,19 +1732,22 @@
17321732

17331733
(rule
17341734
(deps .ocamlformat)
1735+
(enabled_if (>= %{ocaml_version} 5.3))
17351736
(package ocamlformat)
17361737
(action
17371738
(with-stdout-to effects.ml.stdout
17381739
(with-stderr-to effects.ml.stderr
1739-
(run %{bin:ocamlformat} --name effects.ml --margin-check --ocaml-version=5.3 %{dep:../tests/effects.ml})))))
1740+
(run %{bin:ocamlformat} --name effects.ml --margin-check %{dep:../tests/effects.ml})))))
17401741

17411742
(rule
17421743
(alias runtest)
1744+
(enabled_if (>= %{ocaml_version} 5.3))
17431745
(package ocamlformat)
17441746
(action (diff effects.ml.ref effects.ml.stdout)))
17451747

17461748
(rule
17471749
(alias runtest)
1750+
(enabled_if (>= %{ocaml_version} 5.3))
17481751
(package ocamlformat)
17491752
(action (diff effects.ml.err effects.ml.stderr)))
17501753

test/passing/refs.ahrefs/.ocamlformat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
profile=default
2-
ocaml-version=4.14.0
32

43
break-cases=toplevel
54
break-infix-before-func=false

test/passing/refs.default/extensions-indent.ml.ref

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ let _ =
323323

324324
let _ =
325325
f
326-
(object%ext
327-
method x = y
328-
end)
326+
object%ext
327+
method x = y
328+
end
329329

330330
let _ =
331331
f

test/passing/refs.default/extensions.ml.ref

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ let _ =
323323

324324
let _ =
325325
f
326-
(object%ext
327-
method x = y
328-
end)
326+
object%ext
327+
method x = y
328+
end
329329

330330
let _ =
331331
f

test/passing/refs.default/labelled_args.ml.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let _ =
22
let f ~y = y + 1 in
3-
f ~y:(y : int)
3+
f ~(y : int)
44

55
let () =
66
very_long_function_name

test/passing/refs.default/let_punning.ml.ref

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,23 @@ and y = 2
66
and z = 3
77

88
let p =
9-
let* x = x and* y = y and* z = z in
9+
let* x = x and* y and* z = z in
1010
(x, y, z)
1111

1212
let q =
13-
let%foo x = x and y = y and z = z in
13+
let%foo x and y = y and z in
1414
(x, y, z)
1515

1616
let r =
1717
let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
18-
and* (* 5 *) y =
19-
y
18+
and* (* 5 *) y
2019
(* 6 *)
2120
in
2221
(x, y)
2322

2423
let s =
2524
let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
26-
and (* 5 *) y =
27-
y
25+
and (* 5 *) y
2826
(* 6 *)
2927
in
3028
(x, y)

0 commit comments

Comments
 (0)