@@ -3741,6 +3741,7 @@ and fmt_signature_item c ?ext {ast= si; _} =
37413741
37423742and fmt_class_types ?ext c ~pre ~sep cls =
37433743 list_fl cls (fun ~first ~last :_ cl ->
3744+ (* [pci_args] and [pci_constraint] are not used for class types. *)
37443745 update_config_maybe_disabled c cl.pci_loc cl.pci_attributes
37453746 @@ fun c ->
37463747 let ctx = Ctd cl in
@@ -3773,19 +3774,12 @@ and fmt_class_exprs ?ext c cls =
37733774 update_config_maybe_disabled c cl.pci_loc cl.pci_attributes
37743775 @@ fun c ->
37753776 let ctx = Cd cl in
3776- let xargs, xbody = Sugar. cl_fun c.cmts (sub_cl ~ctx cl.pci_expr) in
3777- let ty, e =
3778- match xbody.ast with
3779- | {pcl_desc = Pcl_constraint (e , t ); _} as ce ->
3780- let ctx = Cl ce in
3781- (Some (sub_cty ~ctx t), sub_cl ~ctx e)
3782- | _ -> (None , xbody)
3783- in
3777+ let xargs = cl.pci_args in
37843778 let doc_before, doc_after, atrs =
37853779 let force_before = not (Cl. is_simple cl.pci_expr) in
37863780 fmt_docstring_around_item ~force_before c cl.pci_attributes
37873781 in
3788- let class_exprs =
3782+ let class_expr =
37893783 let pro =
37903784 box_fun_decl_args c 2
37913785 ( hovbox 2
@@ -3799,19 +3793,20 @@ and fmt_class_exprs ?ext c cls =
37993793 $ wrap_fun_decl_args c (fmt_fun_args c xargs) )
38003794 in
38013795 let intro =
3802- match ty with
3796+ match cl.pci_constraint with
38033797 | Some ty ->
3804- let pro = pro $ fmt " :@ " in
3805- fmt_class_type c ~pro ty
3798+ fmt_class_type c ~pro: (pro $ fmt " :@ " ) (sub_cty ~ctx ty)
38063799 | None -> pro
38073800 in
38083801 hovbox 2
3809- (hovbox 2 (intro $ fmt " @ =" ) $ fmt " @;" $ fmt_class_expr c e)
3802+ ( hovbox 2 (intro $ fmt " @ =" )
3803+ $ fmt " @;"
3804+ $ fmt_class_expr c (sub_cl ~ctx cl.pci_expr) )
38103805 $ fmt_item_attributes c ~pre: (Break (1 , 0 )) atrs
38113806 in
38123807 fmt_if (not first) " \n @;<1000 0>"
38133808 $ hovbox 0
3814- @@ Cmts. fmt c cl.pci_loc (doc_before $ class_exprs $ doc_after) )
3809+ @@ Cmts. fmt c cl.pci_loc (doc_before $ class_expr $ doc_after) )
38153810
38163811and fmt_module c ctx ?rec_ ?epi ?(can_sparse = false ) keyword ?(eqty = " =" )
38173812 name xargs xbody xmty ~attrs ~rec_flag =
0 commit comments