@@ -2277,9 +2277,9 @@ let not_function env ty =
22772277 ls = [] && not tvar
22782278
22792279type lazy_args =
2280- (Asttypes.Noloc . arg_label * (unit -> Typedtree .expression ) option ) list
2280+ (Asttypes .arg_label * (unit -> Typedtree .expression ) option ) list
22812281
2282- type targs = (Asttypes.Noloc . arg_label * Typedtree .expression option ) list
2282+ type targs = (Asttypes .arg_label * Typedtree .expression option ) list
22832283let rec type_exp ?recarg env sexp =
22842284 (* We now delegate everything to type_expect *)
22852285 type_expect ?recarg env sexp (newvar () )
@@ -2470,9 +2470,6 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp
24702470 end_def () ;
24712471 unify_var env (newvar () ) funct.exp_type;
24722472
2473- let args_with_loc =
2474- List. map2 (fun (sarg , _ ) (_ , label_exp ) -> (sarg, label_exp)) sargs args
2475- in
24762473 let mk_apply funct args =
24772474 rue
24782475 {
@@ -2491,8 +2488,8 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp
24912488 | _ -> false
24922489 in
24932490
2494- if fully_applied && not is_primitive then rue (mk_apply funct args_with_loc )
2495- else rue (mk_apply funct args_with_loc )
2491+ if fully_applied && not is_primitive then rue (mk_apply funct args )
2492+ else rue (mk_apply funct args )
24962493 | Pexp_match (sarg , caselist ) ->
24972494 begin_def () ;
24982495 let arg = type_exp env sarg in
@@ -3442,7 +3439,7 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
34423439 unify env lhs_type (instance_def Predef. type_int);
34433440 instance_def Predef. type_int
34443441 in
3445- let targs = [(to_noloc lhs_label, Some lhs)] in
3442+ let targs = [(lhs_label, Some lhs)] in
34463443 Some (targs, result_type)
34473444 | ( Some {form = Binary ; specialization},
34483445 [(lhs_label, lhs_expr); (rhs_label, rhs_expr)] ) ->
@@ -3500,9 +3497,7 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
35003497 let rhs = type_expect env rhs_expr Predef. type_int in
35013498 (lhs, rhs, instance_def Predef. type_int))
35023499 in
3503- let targs =
3504- [(to_noloc lhs_label, Some lhs); (to_noloc rhs_label, Some rhs)]
3505- in
3500+ let targs = [(lhs_label, Some lhs); (rhs_label, Some rhs)] in
35063501 Some (targs, result_type)
35073502 | _ -> None )
35083503 | _ -> None
@@ -3601,7 +3596,7 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
36013596 | Tarrow (Optional l , t1 , t2 , _ , _ ) ->
36023597 ignored := (Noloc .Optional l , t1 , ty_fun .level) :: ! ignored;
36033598 let arg =
3604- ( Noloc. Optional l,
3599+ ( to_arg_label ( Optional l) ,
36053600 Some (fun () -> option_none (instance env t1) Location. none) )
36063601 in
36073602 type_unknown_args max_arity ~args: (arg :: args) ~top_arity: None
@@ -3661,7 +3656,8 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
36613656 if optional then unify_exp env arg1 (type_option (newvar () ));
36623657 arg1
36633658 in
3664- type_unknown_args max_arity ~args: ((l1, Some arg1) :: args)
3659+ type_unknown_args max_arity
3660+ ~args: ((to_arg_label l1, Some arg1) :: args)
36653661 ~top_arity: None omitted ty2 sargl
36663662 in
36673663 let rec type_args ?type_clash_context max_arity args omitted ~ty_fun ty_fun0
@@ -3700,8 +3696,9 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
37003696 (extract_option_type env ty)
37013697 (extract_option_type env ty0))) )
37023698 in
3703- type_args ?type_clash_context max_arity ((l, arg) :: args) omitted ~ty_fun
3704- ty_fun0 ~sargs ~top_arity
3699+ type_args ?type_clash_context max_arity
3700+ ((to_arg_label l, arg) :: args)
3701+ omitted ~ty_fun ty_fun0 ~sargs ~top_arity
37053702 | _ ->
37063703 type_unknown_args max_arity ~args ~top_arity omitted ty_fun0
37073704 sargs (* This is the hot path for non-labeled function*)
0 commit comments