Skip to content

Commit

Permalink
PPX: Fix a bug when deriving module types
Browse files Browse the repository at this point in the history
  • Loading branch information
saroupille committed May 12, 2024
1 parent 1cea525 commit 0a126b9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib_ppx/deriver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ let derive_type_declaration env type_declaration =

let derive_type_declarations rec_flag type_declarations :
Ast.structure_item list =
let loc = !Ast_helper.default_loc in
let is_recursive = really_recursive rec_flag type_declarations in
let env =
{ recursive_types=
Expand Down Expand Up @@ -304,16 +303,18 @@ let derive_type_declarations rec_flag type_declarations :
in
Ast_builder.Default.pstr_value_list ~loc is_recursive bindings

let derive_str_signature_item = function
let derive_str_signature_item loc = function
| Psig_type (rec_flag, type_declarations) ->
derive_type_declarations rec_flag type_declarations
{pstr_desc= Pstr_type (rec_flag, type_declarations); pstr_loc= loc}
:: derive_type_declarations rec_flag type_declarations
| _ ->
[]

let derive_str_signature signature =
signature
|> List.map (fun signature_item ->
derive_str_signature_item signature_item.psig_desc )
derive_str_signature_item signature_item.psig_loc
signature_item.psig_desc )
|> List.concat

let derive_str_module_type = function
Expand Down

0 comments on commit 0a126b9

Please sign in to comment.