@@ -2277,9 +2277,9 @@ let not_function env ty =
2277
2277
ls = [] && not tvar
2278
2278
2279
2279
type lazy_args =
2280
- (Asttypes.Noloc . arg_label * (unit -> Typedtree .expression ) option ) list
2280
+ (Asttypes .arg_label * (unit -> Typedtree .expression ) option ) list
2281
2281
2282
- type targs = (Asttypes.Noloc . arg_label * Typedtree .expression option ) list
2282
+ type targs = (Asttypes .arg_label * Typedtree .expression option ) list
2283
2283
let rec type_exp ?recarg env sexp =
2284
2284
(* We now delegate everything to type_expect *)
2285
2285
type_expect ?recarg env sexp (newvar () )
@@ -2470,9 +2470,6 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp
2470
2470
end_def () ;
2471
2471
unify_var env (newvar () ) funct.exp_type;
2472
2472
2473
- let args_with_loc =
2474
- List. map2 (fun (sarg , _ ) (_ , label_exp ) -> (sarg, label_exp)) sargs args
2475
- in
2476
2473
let mk_apply funct args =
2477
2474
rue
2478
2475
{
@@ -2491,8 +2488,8 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp
2491
2488
| _ -> false
2492
2489
in
2493
2490
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 )
2496
2493
| Pexp_match (sarg , caselist ) ->
2497
2494
begin_def () ;
2498
2495
let arg = type_exp env sarg in
@@ -3442,7 +3439,7 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
3442
3439
unify env lhs_type (instance_def Predef. type_int);
3443
3440
instance_def Predef. type_int
3444
3441
in
3445
- let targs = [(to_noloc lhs_label, Some lhs)] in
3442
+ let targs = [(lhs_label, Some lhs)] in
3446
3443
Some (targs, result_type)
3447
3444
| ( Some {form = Binary ; specialization},
3448
3445
[(lhs_label, lhs_expr); (rhs_label, rhs_expr)] ) ->
@@ -3500,9 +3497,7 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
3500
3497
let rhs = type_expect env rhs_expr Predef. type_int in
3501
3498
(lhs, rhs, instance_def Predef. type_int))
3502
3499
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
3506
3501
Some (targs, result_type)
3507
3502
| _ -> None )
3508
3503
| _ -> None
@@ -3601,7 +3596,7 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
3601
3596
| Tarrow (Optional l , t1 , t2 , _ , _ ) ->
3602
3597
ignored := (Noloc .Optional l , t1 , ty_fun .level) :: ! ignored;
3603
3598
let arg =
3604
- ( Noloc. Optional l,
3599
+ ( to_arg_label ( Optional l) ,
3605
3600
Some (fun () -> option_none (instance env t1) Location. none) )
3606
3601
in
3607
3602
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) :
3661
3656
if optional then unify_exp env arg1 (type_option (newvar () ));
3662
3657
arg1
3663
3658
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)
3665
3661
~top_arity: None omitted ty2 sargl
3666
3662
in
3667
3663
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) :
3700
3696
(extract_option_type env ty)
3701
3697
(extract_option_type env ty0))) )
3702
3698
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
3705
3702
| _ ->
3706
3703
type_unknown_args max_arity ~args ~top_arity omitted ty_fun0
3707
3704
sargs (* This is the hot path for non-labeled function*)
0 commit comments