ocaml-jupyter icon indicating copy to clipboard operation
ocaml-jupyter copied to clipboard

[WIP] upgrade to OCaml 5

Open kimmywork opened this issue 1 year ago • 7 comments

kimmywork avatar Mar 21 '23 14:03 kimmywork

Hey @akabe I've tried to upgrade ocaml version to 5.0.0, passed the compile but there are few test cases still failing.

One of the reasons should be following deprecations:

Alert ocaml_deprecated_auto_include:
OCaml's lib directory layout changed in 5.0. The str subdirectory has been
automatically added to the search path, but you should add -I +str to the
command-line to silence this alert (e.g. by adding str to the list of
libraries in your dune file, or adding use_str to your _tags file for
ocamlbuild, or using -package str for ocamlfind).

Affected test cases:

  • Evaluation.eval.directive which loads str.cma
  • Merlin.complete which loads unix.cma

Another reason is related to the toplevel change, and it doesn't accept #require directives. Affected test cases

  • Evaluation.eval.ppx which #require "ppx_deriving.show"

I've commented out these test cases and need your help on the details to fix these for OCaml 5.

kimmywork avatar Mar 21 '23 18:03 kimmywork

The issue of ppx is hard maybe. I have not yet been able to find a solution.

In the official OCaml 5, #require "ppx_deriving.show" prints ppx_deriving: package:ppx_deriving.show: option added at the last, but ocaml-jupyter (OCaml 5) does not.

$ ocaml
OCaml version 5.0.0

# #require "ppx_deriving.show";;
/Users/akabe/.opam/5.0.0/lib/result: added to search path
/Users/akabe/.opam/5.0.0/lib/result/result.cma: loaded
/Users/akabe/.opam/5.0.0/lib/ppx_deriving/runtime: added to search path
/Users/akabe/.opam/5.0.0/lib/ppx_deriving/runtime/ppx_deriving_runtime.cma: loaded
/Users/akabe/.opam/5.0.0/lib/ppx_deriving: added to search path
/Users/akabe/.opam/5.0.0/lib/ppx_deriving/./ppx_deriving: activated
/Users/akabe/.opam/5.0.0/lib/ppx_deriving/show: added to search path
ppx_deriving: package:ppx_deriving.show: option added

スクリーンショット 2023-03-26 15 51 10

akabe avatar Mar 26 '23 06:03 akabe

CI fails due to code format. Try make format.

akabe avatar Mar 26 '23 07:03 akabe

In the official OCaml 5, #require "ppx_deriving.show" prints ppx_deriving: package:ppx_deriving.show: option added at the last, but ocaml-jupyter (OCaml 5) does not.

Same on my side.

I've fixed the code in your comments above, but just found another issue when running make test. It seems that all tests passed, but make test still got an error.

Full output:

  ocaml-jupyter git:(ocaml-5) ✗ make test
opam exec -- dune runtest
File "src/completor/merlin.ml", line 85, characters 4-32:
85 |     notifications : string list;
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 69 [unused-field]: record field notifications is never read.
(However, this field is used to build or mutate values.)
File "tests/repl/eval_util.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/notebook/test_bench.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/completor/test_merlin.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/kernel/fixture.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/kernel/test_zmq_channel.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/completor/test_completor.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/repl/test_evaluation.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/kernel/test_hmac.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/repl/test_process.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/kernel/test_message_channel.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/notebook/test_process.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/kernel/test_kernel.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
File "tests/notebook/test_notebook.pp.ml", line 1:
Warning 70 [missing-mli]: Cannot find interface file.
...
Ran: 3 tests in: 0.12 seconds.
OK
........
Ran: 8 tests in: 0.04 seconds.
OK
....................
Ran: 20 tests in: 0.72 seconds.
OK
File "tests/repl/dune", line 13, characters 0-304:
13 | (alias
14 |  (name   runtest)
15 |  (deps   test_evaluation.bc
16 |          test_process.bc
17 |          ../fixtures/ocamlinit.ml
18 |          ../fixtures/file.bin)
19 |  (action
20 |   (chdir %{project_root}/tests
21 |          (progn
22 |            (run %{dep:test_evaluation.bc})
23 |            (run %{dep:test_process.bc} -runner sequential)))))
...........
Ran: 11 tests in: 0.42 seconds.
OK
make: *** [unit-test] Error 1

kimmywork avatar Mar 27 '23 16:03 kimmywork

I see, all test_evaluation.bc cases passed but got a segment fault result. all test_process.bc cases failed when closing repl, the subprocess status is Killed by signal -10.

kimmywork avatar Mar 27 '23 16:03 kimmywork

@kimmywork Thanks for fixing. I am also aware of the same issue. As it is likely a deep-rooted problem, I anticipate that it will take some time to find a solution, but I will continue my investigation as well. I have been a bit busy lately, so please give me some time.

akabe avatar Apr 03 '23 12:04 akabe