@@ -75,7 +75,6 @@ type error =
75
75
| Literal_overflow of string
76
76
| Unknown_literal of string * char
77
77
| Illegal_letrec_pat
78
- | Labels_omitted of string list
79
78
| Empty_record_literal
80
79
| Uncurried_arity_mismatch of type_expr * int * int
81
80
| Field_not_optional of string * type_expr
@@ -1945,7 +1944,7 @@ let rec list_labels_aux env visited ls ty_fun =
1945
1944
if List. memq ty visited then (List. rev ls, false )
1946
1945
else
1947
1946
match ty.desc with
1948
- | Tarrow (l , _ , ty_res , _ , _ ) ->
1947
+ | Tarrow (l , _ , ty_res , _ , arity ) when arity = None || visited = [] ->
1949
1948
list_labels_aux env (ty :: visited) (l :: ls) ty_res
1950
1949
| _ -> (List. rev ls, is_Tvar ty)
1951
1950
@@ -3539,7 +3538,7 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
3539
3538
in
3540
3539
unify_exp env funct uncurried_typ
3541
3540
else if
3542
- Ast_uncurried. tarrow_to_arity_opt
3541
+ Ast_uncurried. uncurried_type_get_arity_opt ~env
3543
3542
(Ast_uncurried. remove_function_dollar ~env funct.exp_type)
3544
3543
= None
3545
3544
then
@@ -3700,23 +3699,6 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
3700
3699
type_unknown_args max_arity ~args ~top_arity omitted ty_fun0
3701
3700
sargs (* This is the hot path for non-labeled function*)
3702
3701
in
3703
- let () =
3704
- let ls, tvar = list_labels env funct.exp_type in
3705
- if not tvar then
3706
- let labels = Ext_list. filter ls (fun l -> not (is_optional l)) in
3707
- if
3708
- Ext_list. same_length labels sargs
3709
- && List. for_all (fun (l , _ ) -> l = Nolabel ) sargs
3710
- && List. exists (fun l -> l <> Nolabel ) labels
3711
- then
3712
- raise
3713
- (Error
3714
- ( funct.exp_loc,
3715
- env,
3716
- Labels_omitted
3717
- (List. map Printtyp. string_of_label
3718
- (Ext_list. filter labels (fun x -> x <> Nolabel ))) ))
3719
- in
3720
3702
if total_app then force_uncurried_type funct;
3721
3703
let ty, max_arity = extract_uncurried_type funct in
3722
3704
let top_arity = if total_app then Some max_arity else None in
@@ -3728,7 +3710,7 @@ and type_application ?type_clash_context total_app env funct (sargs : sargs) :
3728
3710
in
3729
3711
let exp = type_expect env sarg ty_arg in
3730
3712
(match (expand_head env exp.exp_type).desc with
3731
- | Tarrow _ ->
3713
+ | Tarrow _ when not total_app ->
3732
3714
Location. prerr_warning exp.exp_loc Warnings. Partial_application
3733
3715
| Tvar _ ->
3734
3716
Delayed_checks. add_delayed_check (fun () ->
@@ -4345,23 +4327,6 @@ let report_error env ppf error =
4345
4327
let arity_a = arity_a |> string_of_int in
4346
4328
let arity_b = arity_b |> string_of_int in
4347
4329
report_arity_mismatch ~arity_a ~arity_b ppf
4348
- | Expr_type_clash
4349
- ( ( _,
4350
- {
4351
- desc =
4352
- Tconstr
4353
- (Pdot (Pdot (Pident {name = " Js_OO" }, " Meth" , _), a, _), _, _);
4354
- } )
4355
- :: ( _,
4356
- {
4357
- desc =
4358
- Tconstr
4359
- (Pdot (Pdot (Pident {name = " Js_OO" }, " Meth" , _), b, _), _, _);
4360
- } )
4361
- :: _,
4362
- _ )
4363
- when a <> b ->
4364
- fprintf ppf " This method has %s but was expected %s" a b
4365
4330
| Expr_type_clash (trace , type_clash_context ) ->
4366
4331
(* modified *)
4367
4332
fprintf ppf " @[<v>" ;
@@ -4544,16 +4509,6 @@ let report_error env ppf error =
4544
4509
fprintf ppf " Unknown modifier '%c' for literal %s%c" m n m
4545
4510
| Illegal_letrec_pat ->
4546
4511
fprintf ppf " Only variables are allowed as left-hand side of `let rec'"
4547
- | Labels_omitted [label] ->
4548
- fprintf ppf
4549
- " Label ~%s was omitted in the application of this labeled function." label
4550
- | Labels_omitted labels ->
4551
- let labels_string =
4552
- labels |> List. map (fun label -> " ~" ^ label) |> String. concat " , "
4553
- in
4554
- fprintf ppf
4555
- " Labels %s were omitted in the application of this labeled function."
4556
- labels_string
4557
4512
| Empty_record_literal ->
4558
4513
fprintf ppf
4559
4514
" Empty record literal {} should be type annotated or used in a record \
0 commit comments