@@ -214587,16 +214587,17 @@ and type_pat_aux ~constrs ~labels ~no_existentials ~mode ~explode ~env
214587214587 match ld.lbl_repres with
214588214588 | Record_optional_labels lbls -> Ext_list.mem_string lbls ld.lbl_name
214589214589 | _ -> false in
214590- let process_optional_label (id, ld, pat) =
214590+ let process_optional_label (ld, pat) =
214591214591 let exp_optional_attr =
214592214592 Ext_list.exists pat.ppat_attributes (fun ({txt },_) -> txt = "optional")
214593214593 in
214594214594 if label_is_optional ld && not exp_optional_attr then
214595- let ppat_desc = Ppat_construct ({id with txt = Longident.Lident "Some"}, Some pat)
214596- in { pat with ppat_desc}
214595+ let lid = mknoloc ( Longident.(Ldot ( Lident "*predef*", " Some"))) in
214596+ Ast_helper.Pat.construct ~loc: pat.ppat_loc lid (Some pat)
214597214597 else pat
214598214598 in
214599214599 let type_label_pat (label_lid, label, sarg) k =
214600+ let sarg = process_optional_label (label, sarg) in
214600214601 begin_def ();
214601214602 let (vars, ty_arg, ty_res) = instance_label false label in
214602214603 if vars = [] then end_def ();
@@ -214606,7 +214607,6 @@ and type_pat_aux ~constrs ~labels ~no_existentials ~mode ~explode ~env
214606214607 raise(Error(label_lid.loc, !env,
214607214608 Label_mismatch(label_lid.txt, trace)))
214608214609 end;
214609- let sarg = process_optional_label (label_lid, label, sarg) in
214610214610 type_pat sarg ty_arg (fun arg ->
214611214611 if vars <> [] then begin
214612214612 end_def ();
@@ -215313,8 +215313,9 @@ and type_expect_ ?in_function ?(recarg=Rejected) env sexp ty_expected =
215313215313 Ext_list.exists e.pexp_attributes (fun ({txt },_) -> txt = "optional")
215314215314 in
215315215315 if label_is_optional ld && not exp_optional_attr then
215316- let pexp_desc = Pexp_construct ({id with txt = Longident.Lident "Some"}, Some e)
215317- in (id, ld, {e with pexp_desc})
215316+ let lid = mknoloc (Longident.(Ldot (Lident "*predef*", "Some"))) in
215317+ let e = Ast_helper.Exp.construct ~loc:e.pexp_loc lid (Some e)
215318+ in (id, ld, e)
215318215319 else (id, ld, e)
215319215320 in
215320215321 match sexp.pexp_desc with
0 commit comments