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