File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -494,21 +494,17 @@ let check_tag_field_conflicts (cstrs : Types.constructor_declaration list) =
494494 | Cstr_record fields ->
495495 List. iter
496496 (fun (field : Types.label_declaration ) ->
497- (* Check if field name conflicts with tag *)
498- let field_name = Ident. name field.ld_id in
499- if field_name = tag_name then
500- raise
501- (Error
502- ( cstr.cd_loc,
503- TagFieldNameConflict (Ident. name cstr.cd_id, tag_name) ));
504- (* Check if @as name conflicts with tag *)
505- match process_as_name field.ld_attributes with
506- | Some as_name when as_name = tag_name ->
497+ (* Get the effective field name in JavaScript output *)
498+ let effective_field_name = match process_as_name field.ld_attributes with
499+ | Some as_name -> as_name (* Use @as name if present *)
500+ | None -> Ident. name field.ld_id (* Otherwise use field name *)
501+ in
502+ (* Check if effective field name conflicts with tag *)
503+ if effective_field_name = tag_name then
507504 raise
508505 (Error
509506 ( cstr.cd_loc,
510- TagFieldNameConflict (Ident. name cstr.cd_id, tag_name) ))
511- | _ -> () )
507+ TagFieldNameConflict (Ident. name cstr.cd_id, tag_name) )))
512508 fields
513509 | _ -> () )
514510 cstrs
You can’t perform that action at this time.
0 commit comments