ocaml-ppx / ocamlformat

Auto-formatter for OCaml code
MIT License
633 stars 179 forks source link

OCaml 5.2 support #2524

Closed kit-ty-kate closed 7 months ago

kit-ty-kate commented 9 months ago

ocamlformat currently fails on OCaml 5.2 with:

#=== ERROR while compiling ocamlformat.0.24.1 =================================#
# context              2.2.0~beta2~dev | linux/x86_64 | ocaml-variants.5.2.0+trunk | file:///home/opam/opam-repository
# path                 ~/.opam/5.2/.opam-switch/build/ocamlformat.0.24.1
# command              ~/.opam/5.2/bin/dune build -p ocamlformat -j 1 @install
# exit-code            1
# env-file             ~/.opam/log/ocamlformat-20-f28b05.env
# output-file          ~/.opam/log/ocamlformat-20-f28b05.out
### output ###
# (cd _build/default && /home/opam/.opam/5.2/bin/ocamlc.opt -w -40 -noassert -g -bin-annot -I vendor/parser-shims/.parser_shims.objs/byte -I /home/opam/.opam/5.2/lib/ocaml/compiler-libs -no-alias-deps -o vendor/parser-shims/.parser_shims.objs/byte/parser_shims.cmi -c -intf vendor/parser-shims/parser_shims.mli)
# File "vendor/parser-shims/parser_shims.mli", line 21, characters 9-14:
# 21 |   module Color : sig
#               ^^^^^
# Error: Illegal shadowing of included module "Color/2" by "Color".
# File "vendor/parser-shims/parser_shims.mli", line 19, characters 2-29:
# 19 |   include module type of Misc
#        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#   Module "Color/2" came from this include.
# File "utils/misc.mli", lines 473-522, characters 0-3:
#   The module "Style" has no valid type if "Color/2" is shadowed.
Julow commented 9 months ago

Thanks for the report! This should be mostly fixed by https://github.com/ocaml-ppx/ocamlformat/pull/2512 but this cannot be merged until https://github.com/ocaml-ppx/ocamlformat/issues/2401 is implemented. We're working on it.

aryx commented 8 months ago

would be great to get a fix. We're planning to use 5.2~alpha1 for semgrep, but can't right now because of package conflict with ocamlformat (and also jsoo)

hhugo commented 8 months ago

would be great to get a fix. We're planning to use 5.2~alpha1 for semgrep, but can't right now because of package conflict with ocamlformat (and also jsoo)

(Jsoo 5.7 should have support for ocaml 5.2)

aryx commented 7 months ago

Yes we were able to use jsoo with 5.2. Our only blocker now is ocamlformat. Any ETA for 5.2 support for ocamlformat?

aryx commented 7 months ago

Ideally for us the new ocamlformat package would support 5.2 but also older version of OCaml like 4.14.0.

Julow commented 7 months ago

The release compatible with 5.2 is currently blocked by https://github.com/ocaml-ppx/ocamlformat/pull/2544 which still requires a lot of work. Though, this is not required to make OCamlformat build on 5.2 and we could make a point release that does not contain the function syntax change (https://github.com/ocaml-ppx/ocamlformat/issues/2401).

Julow commented 7 months ago

ocamlformat.0.26.2 with 5.2 support is released: https://github.com/ocaml/opam-repository/pull/25695