@@ -2381,14 +2381,14 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2381
2381
[Vb. mk spat smatch]
2382
2382
sbody
2383
2383
in
2384
- type_function ~context: None ?in_function ~arity ~async loc
2385
- sexp.pexp_attributes env ty_expected l
2384
+ type_function ?in_function ~arity ~async loc sexp.pexp_attributes env
2385
+ ty_expected l
2386
2386
[Exp. case pat body]
2387
2387
| Pexp_fun
2388
2388
{arg_label = l; default = None ; lhs = spat; rhs = sbody; arity; async} ->
2389
2389
let l = Asttypes. to_noloc l in
2390
- type_function ~context: None ?in_function ~arity ~async loc
2391
- sexp.pexp_attributes env ty_expected l
2390
+ type_function ?in_function ~arity ~async loc sexp.pexp_attributes env
2391
+ ty_expected l
2392
2392
[Ast_helper.Exp. case spat sbody]
2393
2393
| Pexp_apply {funct = sfunct ; args = sargs ; partial; transformed_jsx} ->
2394
2394
assert (sargs <> [] );
@@ -2402,7 +2402,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2402
2402
let total_app = not partial in
2403
2403
let context = type_clash_context_from_function sexp sfunct in
2404
2404
let args, ty_res, fully_applied =
2405
- match translate_unified_ops ~context: None env funct sargs with
2405
+ match translate_unified_ops env funct sargs with
2406
2406
| Some (targs , result_type ) -> (targs, result_type, true )
2407
2407
| None -> type_application ~context total_app env funct sargs
2408
2408
in
@@ -2500,8 +2500,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2500
2500
exp_env = env;
2501
2501
}
2502
2502
| Pexp_construct (lid , sarg ) ->
2503
- type_construct ~context: None env loc lid sarg ty_expected
2504
- sexp.pexp_attributes
2503
+ type_construct env loc lid sarg ty_expected sexp.pexp_attributes
2505
2504
| Pexp_variant (l , sarg ) -> (
2506
2505
(* Keep sharing *)
2507
2506
let ty_expected0 = instance env ty_expected in
@@ -2516,7 +2515,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2516
2515
row_field_repr (List. assoc l row0.row_fields) )
2517
2516
with
2518
2517
| Rpresent (Some ty ), Rpresent (Some ty0 ) ->
2519
- let arg = type_argument ~context env sarg ty ty0 in
2518
+ let arg = type_argument ~context: None env sarg ty ty0 in
2520
2519
re
2521
2520
{
2522
2521
exp_desc = Texp_variant (l, Some arg);
@@ -2746,7 +2745,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2746
2745
exp_env = env;
2747
2746
}
2748
2747
| Pexp_field (srecord , lid ) ->
2749
- let record, label, _ = type_label_access ~context: None env srecord lid in
2748
+ let record, label, _ = type_label_access env srecord lid in
2750
2749
let _, ty_arg, ty_res = instance_label false label in
2751
2750
unify_exp ~context: None env record ty_res;
2752
2751
rue
@@ -2759,9 +2758,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2759
2758
exp_env = env;
2760
2759
}
2761
2760
| Pexp_setfield (srecord , lid , snewval ) ->
2762
- let record, label, opath =
2763
- type_label_access ~context: None env srecord lid
2764
- in
2761
+ let record, label, opath = type_label_access env srecord lid in
2765
2762
let ty_record = if opath = None then newvar () else record.exp_type in
2766
2763
let label_loc, label, newval, _ =
2767
2764
type_label_exp ~context: (Some SetRecordField ) false env loc ty_record
@@ -2833,7 +2830,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2833
2830
})
2834
2831
| Pexp_sequence (sexp1 , sexp2 ) ->
2835
2832
let exp1 = type_statement ~context: None env sexp1 in
2836
- let exp2 = type_expect ~context env sexp2 ty_expected in
2833
+ let exp2 = type_expect ~context: None env sexp2 ty_expected in
2837
2834
re
2838
2835
{
2839
2836
exp_desc = Texp_sequence (exp1, exp2);
@@ -2924,7 +2921,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
2924
2921
if separate then begin_def () ;
2925
2922
(* TODO: What should this be?*)
2926
2923
let type_clash_context = None in
2927
- let arg = type_exp ~context env sarg in
2924
+ let arg = type_exp ~context: None env sarg in
2928
2925
let gen =
2929
2926
if separate then (
2930
2927
end_def () ;
@@ -3199,8 +3196,8 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
3199
3196
| Pexp_jsx_element _ ->
3200
3197
failwith " Pexp_jsx_element is expected to be transformed at this point"
3201
3198
3202
- and type_function ~ context ?in_function ~arity ~async loc attrs env ty_expected_
3203
- l caselist =
3199
+ and type_function ?in_function ~arity ~async loc attrs env ty_expected_ l
3200
+ caselist =
3204
3201
let state = Warnings. backup () in
3205
3202
(* Disable Unerasable_optional_argument for uncurried functions *)
3206
3203
let unerasable_optional_argument =
@@ -3212,7 +3209,7 @@ and type_function ~context ?in_function ~arity ~async loc attrs env ty_expected_
3212
3209
| None -> ty_expected_
3213
3210
| Some arity ->
3214
3211
let fun_t = newty (Tarrow (l, newvar () , newvar () , Cok , Some arity)) in
3215
- unify_exp_types ~context loc env fun_t ty_expected_;
3212
+ unify_exp_types ~context: None loc env fun_t ty_expected_;
3216
3213
fun_t
3217
3214
in
3218
3215
let loc_fun, ty_fun =
@@ -3267,8 +3264,8 @@ and type_function ~context ?in_function ~arity ~async loc attrs env ty_expected_
3267
3264
exp_env = env;
3268
3265
}
3269
3266
3270
- and type_label_access ~ context env srecord lid =
3271
- let record = type_exp ~context ~recarg: Allowed env srecord in
3267
+ and type_label_access env srecord lid =
3268
+ let record = type_exp ~context: None ~recarg: Allowed env srecord in
3272
3269
let ty_exp = record.exp_type in
3273
3270
let opath =
3274
3271
try
@@ -3353,9 +3350,8 @@ and type_argument ~context ?recarg env sarg ty_expected' ty_expected =
3353
3350
(* * This is ad-hoc translation for unifying specific primitive operations
3354
3351
See [Unified_ops] module for detailed explanation.
3355
3352
*)
3356
- and translate_unified_ops ~ context (env : Env.t ) (funct : Typedtree.expression )
3353
+ and translate_unified_ops (env : Env.t ) (funct : Typedtree.expression )
3357
3354
(sargs : sargs ) : (targs * Types.type_expr) option =
3358
- ignore context;
3359
3355
match funct.exp_desc with
3360
3356
| Texp_ident (path , _ , _ ) -> (
3361
3357
let entry = Hashtbl. find_opt Unified_ops. index_by_path (Path. name path) in
@@ -3684,9 +3680,7 @@ and type_application ~context total_app env funct (sargs : sargs) :
3684
3680
in
3685
3681
(targs, ret_t, fully_applied)
3686
3682
3687
- and type_construct ~context env loc lid sarg ty_expected attrs =
3688
- (* TODO: Fix this *)
3689
- ignore context;
3683
+ and type_construct env loc lid sarg ty_expected attrs =
3690
3684
let opath =
3691
3685
try
3692
3686
let p0, p, _ = extract_concrete_variant env ty_expected in
0 commit comments