Skip to content

Commit ce32aa4

Browse files
authored
Merge pull request #510 from anmonteiro/anmonteiro/ocaml-5.5-support
support OCaml 5.5
2 parents 33201e6 + 629b067 commit ce32aa4

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

src/lib/uTop.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,15 @@ let check_phrase phrase =
360360
with_default_loc loc
361361
(fun () ->
362362
let punit = (Pat.construct unit None) in
363+
#if OCAML_VERSION >= (5, 5, 0)
364+
let si = Str.module_ ~loc (Mb.mk ~loc (with_loc loc (Some "_")) (Mod.structure (item :: items))) in
365+
let body = (Exp.struct_item ~loc si (Exp.construct unit None)) in
366+
#else
363367
let body = (Exp.letmodule ~loc:loc
364368
(with_loc loc (Some "_"))
365369
(Mod.structure (item :: items))
366370
(Exp.construct unit None)) in
371+
#endif
367372
Str.eval (UTop_compat.Exp.fun_ ~loc punit body))
368373
in
369374
let check_phrase = Ptop_def [top_def] in

src/lib/uTop_complete.ml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,16 @@ let add_fields_of_type decl acc =
390390
List.fold_left (fun acc field -> add (field_name field) acc) acc fields
391391
#if OCAML_VERSION >= (5, 2, 0)
392392
| Type_abstract _ ->
393-
#else
393+
#else
394394
| Type_abstract ->
395395
#endif
396396
acc
397397
| Type_open ->
398398
acc
399+
#if OCAML_VERSION >= (5, 5, 0)
400+
| Type_external _ ->
401+
acc
402+
#endif
399403

400404
let add_names_of_type decl acc =
401405
match decl.type_kind with
@@ -409,12 +413,17 @@ let add_names_of_type decl acc =
409413
List.fold_left (fun acc field -> add (field_name field) acc) acc fields
410414
#if OCAML_VERSION >= (5, 2, 0)
411415
| Type_abstract _ ->
412-
#else
416+
#else
413417
| Type_abstract ->
414418
#endif
415419
acc
416420
| Type_open ->
417421
acc
422+
#if OCAML_VERSION >= (5, 5, 0)
423+
| Type_external _ ->
424+
acc
425+
#endif
426+
418427

419428
let path_of_mty_alias = function
420429
| Mty_alias path -> path
@@ -527,7 +536,11 @@ let list_global_names () =
527536
loop (add (Ident.name id) acc) summary
528537
| Env.Env_cltype(summary, id, _) ->
529538
loop (add (Ident.name id) acc) summary
539+
#if OCAML_VERSION >= (5, 5, 0)
540+
| Env.Env_not_aliasable(summary, id) ->
541+
#else
530542
| Env.Env_functor_arg(summary, id) ->
543+
#endif
531544
loop (add (Ident.name id) acc) summary
532545
| Env.Env_persistent (summary, id) ->
533546
loop (add (Ident.name id) acc) summary
@@ -575,7 +588,11 @@ let list_global_fields () =
575588
loop (add (Ident.name id) acc) summary
576589
| Env.Env_module(summary, id, _, _) ->
577590
loop (add (Ident.name id) acc) summary
591+
#if OCAML_VERSION >= (5, 5, 0)
592+
| Env.Env_not_aliasable(summary, id) ->
593+
#else
578594
| Env.Env_functor_arg(summary, id) ->
595+
#endif
579596
loop (add (Ident.name id) acc) summary
580597
| Env.Env_modtype(summary, id, _) ->
581598
loop (add (Ident.name id) acc) summary

src/lib/uTop_main.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ end = struct
380380
| Env.Env_class (s, _, _)
381381
| Env.Env_cltype (s, _, _)
382382
| Env.Env_open (s, _)
383-
| Env.Env_functor_arg (s, _)
383+
#if OCAML_VERSION >= (5, 5, 0)
384+
| Env.Env_not_aliasable(s, _)
385+
#else
386+
| Env.Env_functor_arg(s, _)
387+
#endif
384388
| Env.Env_constraints (s, _) ->
385389
scan_summary last s
386390
in

0 commit comments

Comments
 (0)