Skip to content

Commit

Permalink
default wrap to true in ppx_deriving_err_case
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtori committed Nov 6, 2024
1 parent 61639e4 commit 64a887c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ppx/ppx_deriving_err_case.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ let attribute_code ~code attrs =
match c, code with Some c, _ | _, Some c -> c | _ -> 500

let attribute_nowrap attrs =
List.find_map (fun a -> match a.attr_name.txt with
let wrap = List.find_map (fun a -> match a.attr_name.txt with
| "nowrap" -> Some false
| _ -> None) attrs
| _ -> None) attrs in
Option.value ~default:true wrap

let str_type_ext ~loc:_ ~path:_ t debug code =
let loc = t.ptyext_loc in
Expand All @@ -111,7 +112,7 @@ let str_type_ext ~loc:_ ~path:_ t debug code =
| Pext_decl ([], args, None) ->
let code = attribute_code ~code pext.pext_attributes in
let wrap = attribute_nowrap pext.pext_attributes in
let case = Encoding.resolve_case ~loc @@ Encoding.constructor_label ?wrap ~case:`snake
let case = Encoding.resolve_case ~loc @@ Encoding.constructor_label ~wrap ~case:`snake
~loc ~name:pext.pext_name.txt ~attrs:pext.pext_attributes args in
let select = pext.pext_name.txt, (match args with Pcstr_tuple [] -> false | _ -> true) in
Some (code, case, select)
Expand Down

0 comments on commit 64a887c

Please sign in to comment.