@@ -2280,9 +2280,9 @@ let not_function env ty =
2280
2280
ls = [] && not tvar
2281
2281
2282
2282
type lazy_args =
2283
- (Asttypes.Noloc . arg_label * (unit -> Typedtree .expression ) option ) list
2283
+ (Asttypes .arg_label * (unit -> Typedtree .expression ) option ) list
2284
2284
2285
- type targs = (Asttypes.Noloc . arg_label * Typedtree .expression option ) list
2285
+ type targs = (Asttypes .arg_label * Typedtree .expression option ) list
2286
2286
let rec type_exp ?recarg env sexp =
2287
2287
(* We now delegate everything to type_expect *)
2288
2288
type_expect ?recarg env sexp (newvar () )
@@ -2473,9 +2473,6 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp
2473
2473
end_def () ;
2474
2474
unify_var env (newvar () ) funct.exp_type;
2475
2475
2476
- let args_with_loc =
2477
- List. map2 (fun (sarg , _ ) (_ , label_exp ) -> (sarg, label_exp)) sargs args
2478
- in
2479
2476
let mk_apply funct args =
2480
2477
rue
2481
2478
{
@@ -2494,8 +2491,8 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp
2494
2491
| _ -> false
2495
2492
in
2496
2493
2497
- if fully_applied && not is_primitive then rue (mk_apply funct args_with_loc )
2498
- else rue (mk_apply funct args_with_loc )
2494
+ if fully_applied && not is_primitive then rue (mk_apply funct args )
2495
+ else rue (mk_apply funct args )
2499
2496
| Pexp_match (sarg , caselist ) ->
2500
2497
begin_def () ;
2501
2498
let arg = type_exp env sarg in
@@ -3448,7 +3445,7 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
3448
3445
unify env lhs_type (instance_def Predef. type_int);
3449
3446
instance_def Predef. type_int
3450
3447
in
3451
- let targs = [(to_noloc lhs_label, Some lhs)] in
3448
+ let targs = [(lhs_label, Some lhs)] in
3452
3449
Some (targs, result_type)
3453
3450
| ( Some {form = Binary ; specialization},
3454
3451
[(lhs_label, lhs_expr); (rhs_label, rhs_expr)] ) ->
@@ -3506,9 +3503,7 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
3506
3503
let rhs = type_expect env rhs_expr Predef. type_int in
3507
3504
(lhs, rhs, instance_def Predef. type_int))
3508
3505
in
3509
- let targs =
3510
- [(to_noloc lhs_label, Some lhs); (to_noloc rhs_label, Some rhs)]
3511
- in
3506
+ let targs = [(lhs_label, Some lhs); (rhs_label, Some rhs)] in
3512
3507
Some (targs, result_type)
3513
3508
| _ -> None )
3514
3509
| _ -> None
@@ -3607,7 +3602,7 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
3607
3602
| Tarrow (Optional l , t1 , t2 , _ , _ ) ->
3608
3603
ignored := (Noloc .Optional l , t1 , ty_fun .level) :: ! ignored;
3609
3604
let arg =
3610
- ( Noloc. Optional l,
3605
+ ( to_arg_label ( Optional l) ,
3611
3606
Some (fun () -> option_none (instance env t1) Location. none) )
3612
3607
in
3613
3608
type_unknown_args max_arity ~args: (arg :: args) ~top_arity: None
@@ -3667,7 +3662,8 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
3667
3662
if optional then unify_exp env arg1 (type_option (newvar () ));
3668
3663
arg1
3669
3664
in
3670
- type_unknown_args max_arity ~args: ((l1, Some arg1) :: args)
3665
+ type_unknown_args max_arity
3666
+ ~args: ((to_arg_label l1, Some arg1) :: args)
3671
3667
~top_arity: None omitted ty2 sargl
3672
3668
in
3673
3669
let rec type_args ?type_clash_context max_arity args omitted ~ty_fun ty_fun0
@@ -3706,8 +3702,9 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
3706
3702
(extract_option_type env ty)
3707
3703
(extract_option_type env ty0))) )
3708
3704
in
3709
- type_args ?type_clash_context max_arity ((l, arg) :: args) omitted ~ty_fun
3710
- ty_fun0 ~sargs ~top_arity
3705
+ type_args ?type_clash_context max_arity
3706
+ ((to_arg_label l, arg) :: args)
3707
+ omitted ~ty_fun ty_fun0 ~sargs ~top_arity
3711
3708
| _ ->
3712
3709
type_unknown_args max_arity ~args ~top_arity omitted ty_fun0
3713
3710
sargs (* This is the hot path for non-labeled function*)
0 commit comments