Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 4.14.0 (beta1) #179

Merged
merged 14 commits into from
Feb 28, 2022
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- 4.11.0
- 4.12.0
- 4.13.0
- ocaml-base-compiler.4.14.0~beta1

steps:
- uses: actions/checkout@v2
Expand All @@ -32,6 +33,9 @@ jobs:
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
cache-prefix: opam-${{ matrix.ocaml-compiler }}-
opam-repositories: |
default: https://github.com/ocaml/opam-repository.git
beta: https://github.com/ocaml/ocaml-beta-repository.git
- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion jupyter.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build: [
[ "dune" "build" "-p" name "-j" jobs ]
]
depends: [
"ocaml" {>= "4.04.0" & < "4.14"}
"ocaml" {>= "4.04.0" & < "4.15"}
"base-threads"
"base-unix"
"uuidm" {>= "0.9.6"}
Expand Down
2 changes: 1 addition & 1 deletion jupyter/src/comm/manager.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct
let default = `Assoc []

let create ?(data = default) target =
let comm_id = Uuidm.(to_string (create `V4)) in
let comm_id = Uuidm.(to_string (v `V4)) in
ignore (register target comm_id) ;
Jupyter_notebook__Unsafe.send_iopub
(IOPUB_COMM_OPEN {
Expand Down
2 changes: 1 addition & 1 deletion jupyter/src/core/message.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let epoch_to_iso8601_string epoch =

let create_next ?(time = Unix.gettimeofday ()) ~content_to_yojson parent content =
let date = Some (epoch_to_iso8601_string time) in
let msg_id = Uuidm.(to_string (create `V4)) in
let msg_id = Uuidm.(to_string (v `V4)) in
let msg_type =
match content_to_yojson content with
| `List (`String msg_type :: _) -> msg_type
Expand Down
2 changes: 1 addition & 1 deletion jupyter/src/notebook/jupyter_notebook.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ let display ?ctx ?display_id ?(metadata = `Assoc []) ?(base64 = false) mime data
let send content = Unsafe.send_iopub ?ctx content in
match display_id with
| None ->
let display_id = Uuidm.(to_string (create `V4)) in
let display_id = Uuidm.(to_string (v `V4)) in
send (IOPUB_DISPLAY_DATA {
display_data = `Assoc [mime, `String data];
display_metadata = metadata;
Expand Down
10 changes: 10 additions & 0 deletions jupyter/src/repl/caml_args.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ let file_argument name =
(Array.length Sys.argv - !Arg.current)
in
Compenv.readenv ppf Compenv.Before_link;
#if OCAML_VERSION < (4,14,0)
if prepare ppf && Toploop.run_script ppf name newargs
#else
if prepare ppf && Toploop.run_script ppf (Toploop.File name) newargs
#endif
then exit 0
else exit 2
end
Expand Down Expand Up @@ -205,6 +209,12 @@ module Options = Main_args.Make_bytetop_options (struct
let _dlocations = set Clflags.locations
let _dno_locations = clear Clflags.locations
#endif

#if OCAML_VERSION >= (4,14,0)
let _force_tmc = set Clflags.force_tmc
let _dshape = set Clflags.dump_shape
let _eval (_ : string) = ()
#endif
end)

#if OCAML_VERSION >= (4,05,0)
Expand Down
5 changes: 5 additions & 0 deletions jupyter/src/repl/dune
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
(deps error.cppo.ml)
(action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets})))

(rule
(targets evaluation.ml)
(deps evaluation.cppo.ml)
(action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets})))

(rule
(targets lwt_async_rewrite.ml)
(deps lwt_async_rewrite.cppo.ml)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ let init ?(preinit = ignore) ?init_file () =
preinit () ;
begin match init_file with
| None -> ()
| Some path -> ignore (Toploop.use_silently Format.std_formatter path)
| Some path ->
#if OCAML_VERSION < (4,14,0)
ignore (Toploop.use_silently Format.std_formatter path)
#else
ignore (Toploop.use_silently Format.std_formatter (Toploop.File path))
#endif
end

let setvalue name value = Toploop.setvalue name (Obj.repr value)
Expand Down
12 changes: 11 additions & 1 deletion jupyter/src/repl/lwt_async_rewrite.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ let rule_path rule =
; Types.type_manifest = Some ty
; _
} -> begin
#if OCAML_VERSION < (4,14,0)
match Ctype.expand_head env ty with
#else
match Types.Transient_expr.repr (Ctype.expand_head env ty) with
#endif
| { Types.desc = Types.Tconstr (path, _, _); _ } -> path
| _ -> path
end
Expand Down Expand Up @@ -132,7 +136,11 @@ let is_eval = function

(* Returns the rewrite rule associated to a type, if any. *)
let rule_of_type typ =
#if OCAML_VERSION < (4,14,0)
match (Ctype.expand_head !Toploop.toplevel_env typ).Types.desc with
#else
match (Types.Transient_expr.repr (Ctype.expand_head !Toploop.toplevel_env typ)).Types.desc with
#endif
| Types.Tconstr (path, _, _) -> begin
try
Some (List.find (fun rule -> rule_matches rule path) rewrite_rules)
Expand Down Expand Up @@ -165,8 +173,10 @@ let rewrite phrase =
let tstr, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr Location.none in
#elif OCAML_VERSION < (4,12,0)
let tstr, _, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr Location.none in
#else
#elif OCAML_VERSION < (4,14,0)
let tstr, _, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr in
#else
let tstr, _, _, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr in
#endif
Parsetree.Ptop_def (List.map2 rewrite_str_item pstr tstr.Typedtree.str_items)
else
Expand Down