Merge pull request #355 from kit-ty-kate/413

Update the OCaml 4.13 compatibility after the merge of ocaml/ocaml#10252
This commit is contained in:
Rudi Grinberg 2021-06-02 12:59:42 -07:00 committed by GitHub
commit 10502c50a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -419,7 +419,11 @@ let constructor_name { cd_id = id } = Ident.name id
let add_fields_of_type decl acc =
match decl.type_kind with
#if OCAML_VERSION >= (4, 13, 0)
| Type_variant (constructors, _) ->
#else
| Type_variant constructors ->
#endif
acc
| Type_record (fields, _) ->
List.fold_left (fun acc field -> add (field_name field) acc) acc fields
@ -430,7 +434,11 @@ let add_fields_of_type decl acc =
let add_names_of_type decl acc =
match decl.type_kind with
#if OCAML_VERSION >= (4, 13, 0)
| Type_variant (constructors, _) ->
#else
| Type_variant constructors ->
#endif
List.fold_left (fun acc cstr -> add (constructor_name cstr) acc) acc constructors
| Type_record (fields, _) ->
List.fold_left (fun acc field -> add (field_name field) acc) acc fields