ocaml version is set to 5.4.0 by default to allow effects#2750
ocaml version is set to 5.4.0 by default to allow effects#2750Julow merged 10 commits intoocaml-ppx:mainfrom
Conversation
|
Honestly, I can of want to make a release just for this. |
Julow
left a comment
There was a problem hiding this comment.
I totally agree with this change !
ocaml-version must incremented, otherwise everyone has to set it. I'm also happy to do a big increment, compared to a short increment after each release, so that the disruption happens less often and is more easily recognized and fixed.
Honestly, I can of want to make a release just for this.
I'm not fond of releasing often, as each release has a cost for the community. Each release create incompatibilities for people that install OCamlformat using Opam.
The tests don't pass according to the CI. Can you check ?
Agreed, releasing often is an issue, but when I found this, I thought for a while that we actually did not have compatibility with 5.4, that we forgot to add some of the syntax or something. It took looking at the tests to understand what was happening, and I don't think a regular user of ocamlformat would be able to, and he would just get the impression that ocamlformat is not compatible with the new syntax. Even though releasing often is problematic, I think this is worse. I will check the tests. |
|
The tests are failing because |
d436064 to
2a77a70
Compare
|
@Julow I could indeed replicate the failure with a 4.14 switch, but I still don't understand whats happening or how to fix it |
85864c7 to
21e756c
Compare
|
It was a missing |
CHANGES: ### Highlight - \* Support OCaml 5.5 syntax (ocaml-ppx/ocamlformat#2772, ocaml-ppx/ocamlformat#2774, ocaml-ppx/ocamlformat#2775, ocaml-ppx/ocamlformat#2777, ocaml-ppx/ocamlformat#2780, ocaml-ppx/ocamlformat#2781, ocaml-ppx/ocamlformat#2782, ocaml-ppx/ocamlformat#2783, @Julow) The update brings several tiny changes, they are listed below. - \* Update Odoc's parser to 3.0 (ocaml-ppx/ocamlformat#2757, @Julow) The indentation of code-blocks containing OCaml code is reduced by 2 to avoid changing the generated documentation. The indentation within code-blocks is now significative in Odoc and shows up in generated documentation. ### Added - Added option `letop-punning` (ocaml-ppx/ocamlformat#2746, @WardBrian) to control whether punning is used in extended binding operators. For example, the code `let+ x = x in ...` can be formatted as `let+ x in ...` when `letop-punning=always`. With `letop-punning=never`, it becomes `let+ x = x in ...`. The default is `preserve`, which will only use punning when it exists in the source. This also applies to `let%ext` bindings (ocaml-ppx/ocamlformat#2747, @WardBrian). - Support the unnamed functor parameters syntax in module types (ocaml-ppx/ocamlformat#2755, ocaml-ppx/ocamlformat#2759, @Julow) ```ocaml module type F = ARG -> S ``` The following lines are now formatted as they are in the source file: ```ocaml module M : (_ : S) -> (_ : S) -> S = N module M : S -> S -> S = N (* The preceding two lines are no longer turned into this: *) module M : (_ : S) (_ : S) -> S = N ``` ### Fixed - Fix dropped comment in `(function _ -> x (* cmt *))` (ocaml-ppx/ocamlformat#2739, @Julow) - \* `cases-matching-exp-indent=compact` does not impact `begin end` nodes that don't have a match inside. (ocaml-ppx/ocamlformat#2742, @EmileTrotignon) ```ocaml (* before *) begin match () with | () -> begin f x end end (* after *) begin match () with | () -> begin f x end end ``` - `Ast_mapper` now iterates on *all* locations inside of Longident.t, instead of only some. (ocaml-ppx/ocamlformat#2737, @v-gb) - Remove line break in `M with module N = N (* cmt *)` (ocaml-ppx/ocamlformat#2779, @Julow) ### Internal - Added information on writing tests to `CONTRIBUTING.md` (ocaml-ppx/ocamlformat#2838, @WardBrian) ### Changed - indentation of the `end` keyword in a match-case is now always at least 2. (ocaml-ppx/ocamlformat#2742, @EmileTrotignon) ```ocaml (* before *) begin match () with | () -> begin match () with | () -> () end end (* after *) begin match () with | () -> begin match () with | () -> () - \* use shortcut `begin end` in `match` cases and `if then else` body. (ocaml-ppx/ocamlformat#2744, @EmileTrotignon) ```ocaml (* before *) match () with | () -> begin match () with | () -> end end (* after *) match () with | () -> begin match () with | () -> end end ``` - \* Set the `ocaml-version` to `5.4` by default (ocaml-ppx/ocamlformat#2750, @EmileTrotignon) The main difference is that the `effect` keyword is recognized without having to add `ocaml-version=5.3` to the configuration. In exchange, code that use `effect` as an identifier must use `ocaml-version=5.2`. - The work to support OCaml 5.5 come with several improvements: + Improve the indentation of `let structure-item` with the `[@ocamlformat "disable"]` attribute. `let structure-item` means `let module`, `let open`, `let include` and `let exception`. + `(let open M in e)[@A]` is turned into `let[@A] open M in e`. + Long `let open ... in` no longer exceed the margin. + Improve indentation of `let structure-item` within parentheses: ```ocaml (* before *) (let module M = M in M.foo) (* after *) (let module M = M in M.foo) ```
CHANGES: ### Highlight - \* Support OCaml 5.5 syntax (ocaml-ppx/ocamlformat#2772, ocaml-ppx/ocamlformat#2774, ocaml-ppx/ocamlformat#2775, ocaml-ppx/ocamlformat#2777, ocaml-ppx/ocamlformat#2780, ocaml-ppx/ocamlformat#2781, ocaml-ppx/ocamlformat#2782, ocaml-ppx/ocamlformat#2783, @Julow) The update brings several tiny changes, they are listed below. - \* Update Odoc's parser to 3.0 (ocaml-ppx/ocamlformat#2757, @Julow) The indentation of code-blocks containing OCaml code is reduced by 2 to avoid changing the generated documentation. The indentation within code-blocks is now significative in Odoc and shows up in generated documentation. ### Added - Added option `letop-punning` (ocaml-ppx/ocamlformat#2746, @WardBrian) to control whether punning is used in extended binding operators. For example, the code `let+ x = x in ...` can be formatted as `let+ x in ...` when `letop-punning=always`. With `letop-punning=never`, it becomes `let+ x = x in ...`. The default is `preserve`, which will only use punning when it exists in the source. This also applies to `let%ext` bindings (ocaml-ppx/ocamlformat#2747, @WardBrian). - Support the unnamed functor parameters syntax in module types (ocaml-ppx/ocamlformat#2755, ocaml-ppx/ocamlformat#2759, @Julow) ```ocaml module type F = ARG -> S ``` The following lines are now formatted as they are in the source file: ```ocaml module M : (_ : S) -> (_ : S) -> S = N module M : S -> S -> S = N (* The preceding two lines are no longer turned into this: *) module M : (_ : S) (_ : S) -> S = N ``` ### Fixed - Fix dropped comment in `(function _ -> x (* cmt *))` (ocaml-ppx/ocamlformat#2739, @Julow) - \* `cases-matching-exp-indent=compact` does not impact `begin end` nodes that don't have a match inside. (ocaml-ppx/ocamlformat#2742, @EmileTrotignon) ```ocaml (* before *) begin match () with | () -> begin f x end end (* after *) begin match () with | () -> begin f x end end ``` - `Ast_mapper` now iterates on *all* locations inside of Longident.t, instead of only some. (ocaml-ppx/ocamlformat#2737, @v-gb) - Remove line break in `M with module N = N (* cmt *)` (ocaml-ppx/ocamlformat#2779, @Julow) ### Internal - Added information on writing tests to `CONTRIBUTING.md` (ocaml-ppx/ocamlformat#2838, @WardBrian) ### Changed - indentation of the `end` keyword in a match-case is now always at least 2. (ocaml-ppx/ocamlformat#2742, @EmileTrotignon) ```ocaml (* before *) begin match () with | () -> begin match () with | () -> () end end (* after *) begin match () with | () -> begin match () with | () -> () - \* use shortcut `begin end` in `match` cases and `if then else` body. (ocaml-ppx/ocamlformat#2744, @EmileTrotignon) ```ocaml (* before *) match () with | () -> begin match () with | () -> end end (* after *) match () with | () -> begin match () with | () -> end end ``` - \* Set the `ocaml-version` to `5.4` by default (ocaml-ppx/ocamlformat#2750, @EmileTrotignon) The main difference is that the `effect` keyword is recognized without having to add `ocaml-version=5.3` to the configuration. In exchange, code that use `effect` as an identifier must use `ocaml-version=5.2`. - The work to support OCaml 5.5 come with several improvements: + Improve the indentation of `let structure-item` with the `[@ocamlformat "disable"]` attribute. `let structure-item` means `let module`, `let open`, `let include` and `let exception`. + `(let open M in e)[@A]` is turned into `let[@A] open M in e`. + Long `let open ... in` no longer exceed the margin. + Improve indentation of `let structure-item` within parentheses: ```ocaml (* before *) (let module M = M in M.foo) (* after *) (let module M = M in M.foo) ```
Right now you need to have --ocaml-version=5.3.0 or 5.4.0 to be able to use the effect syntax.
This is a big issue because otherwise you get a very annoying syntax error message and its difficult to understand what is happening.
This causes a bunch of diffs elsewhere in the tests. Its mostly improvements in my opinion. Some of it is related to let-punning, we should check it works correctly.