Skip to content

Commit 887fc6f

Browse files
committed
Format code
1 parent f65bc01 commit 887fc6f

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

compiler/ml/ast_untagged_variants.ml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ let report_error ppf =
9393
"Constructor " ^ name ^ " has more than one argument.")
9494
| TagFieldNameConflict (constructor_name, field_name) ->
9595
fprintf ppf
96-
"Constructor %s: the @tag name \"%s\" conflicts with inline record field \"%s\". \
97-
Use a different @tag name or rename the field."
96+
"Constructor %s: the @tag name \"%s\" conflicts with inline record field \
97+
\"%s\". Use a different @tag name or rename the field."
9898
constructor_name field_name field_name
9999

100100
(* Type of the runtime representation of an untagged block (case with payoad) *)
@@ -328,10 +328,10 @@ let process_as_name (attrs : Parsetree.attributes) =
328328
Ext_list.iter attrs (fun ({txt; loc}, payload) ->
329329
match txt with
330330
| "as" ->
331-
if !st = None then (
332-
(match Ast_payload.is_single_string payload with
331+
if !st = None then
332+
match Ast_payload.is_single_string payload with
333333
| None -> ()
334-
| Some (s, _dec) -> st := Some s))
334+
| Some (s, _dec) -> st := Some s
335335
else raise (Error (loc, Duplicated_bs_as))
336336
| _ -> ());
337337
!st
@@ -482,25 +482,33 @@ let names_from_type_variant ?(is_untagged_def = false) ~env
482482
Some {consts; blocks}
483483

484484
let check_tag_field_conflicts (cstrs : Types.constructor_declaration list) =
485-
List.iter (fun (cstr : Types.constructor_declaration) ->
486-
match process_tag_name cstr.cd_attributes with
487-
| Some tag_name -> (
485+
List.iter
486+
(fun (cstr : Types.constructor_declaration) ->
487+
match process_tag_name cstr.cd_attributes with
488+
| Some tag_name -> (
488489
match cstr.cd_args with
489490
| Cstr_record fields ->
490-
List.iter (fun (field : Types.label_declaration) ->
491+
List.iter
492+
(fun (field : Types.label_declaration) ->
491493
(* Check if field name conflicts with tag *)
492494
let field_name = Ident.name field.ld_id in
493495
if field_name = tag_name then
494-
raise (Error (cstr.cd_loc, TagFieldNameConflict (Ident.name cstr.cd_id, tag_name)));
496+
raise
497+
(Error
498+
( cstr.cd_loc,
499+
TagFieldNameConflict (Ident.name cstr.cd_id, tag_name) ));
495500
(* Check if @as name conflicts with tag *)
496501
match process_as_name field.ld_attributes with
497502
| Some as_name when as_name = tag_name ->
498-
raise (Error (cstr.cd_loc, TagFieldNameConflict (Ident.name cstr.cd_id, tag_name)))
499-
| _ -> ()
500-
) fields
503+
raise
504+
(Error
505+
( cstr.cd_loc,
506+
TagFieldNameConflict (Ident.name cstr.cd_id, tag_name) ))
507+
| _ -> ())
508+
fields
501509
| _ -> ())
502-
| None -> ()
503-
) cstrs
510+
| None -> ())
511+
cstrs
504512

505513
type well_formedness_check = {
506514
is_untagged_def: bool;

0 commit comments

Comments
 (0)