@@ -2384,14 +2384,14 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
23842384 [Vb. mk spat smatch]
23852385 sbody
23862386 in
2387- type_function ~context: None ?in_function ~arity ~async loc
2388- sexp.pexp_attributes env ty_expected l
2387+ type_function ?in_function ~arity ~async loc sexp.pexp_attributes env
2388+ ty_expected l
23892389 [Exp. case pat body]
23902390 | Pexp_fun
23912391 {arg_label = l; default = None ; lhs = spat; rhs = sbody; arity; async} ->
23922392 let l = Asttypes. to_noloc l in
2393- type_function ~context: None ?in_function ~arity ~async loc
2394- sexp.pexp_attributes env ty_expected l
2393+ type_function ?in_function ~arity ~async loc sexp.pexp_attributes env
2394+ ty_expected l
23952395 [Ast_helper.Exp. case spat sbody]
23962396 | Pexp_apply {funct = sfunct ; args = sargs ; partial; transformed_jsx} ->
23972397 assert (sargs <> [] );
@@ -2405,7 +2405,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
24052405 let total_app = not partial in
24062406 let context = type_clash_context_from_function sexp sfunct in
24072407 let args, ty_res, fully_applied =
2408- match translate_unified_ops ~context: None env funct sargs with
2408+ match translate_unified_ops env funct sargs with
24092409 | Some (targs , result_type ) -> (targs, result_type, true )
24102410 | None -> type_application ~context total_app env funct sargs
24112411 in
@@ -2503,8 +2503,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
25032503 exp_env = env;
25042504 }
25052505 | Pexp_construct (lid , sarg ) ->
2506- type_construct ~context: None env loc lid sarg ty_expected
2507- sexp.pexp_attributes
2506+ type_construct env loc lid sarg ty_expected sexp.pexp_attributes
25082507 | Pexp_variant (l , sarg ) -> (
25092508 (* Keep sharing *)
25102509 let ty_expected0 = instance env ty_expected in
@@ -2519,7 +2518,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
25192518 row_field_repr (List. assoc l row0.row_fields) )
25202519 with
25212520 | Rpresent (Some ty ), Rpresent (Some ty0 ) ->
2522- let arg = type_argument ~context env sarg ty ty0 in
2521+ let arg = type_argument ~context: None env sarg ty ty0 in
25232522 re
25242523 {
25252524 exp_desc = Texp_variant (l, Some arg);
@@ -2749,7 +2748,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
27492748 exp_env = env;
27502749 }
27512750 | Pexp_field (srecord , lid ) ->
2752- let record, label, _ = type_label_access ~context: None env srecord lid in
2751+ let record, label, _ = type_label_access env srecord lid in
27532752 let _, ty_arg, ty_res = instance_label false label in
27542753 unify_exp ~context: None env record ty_res;
27552754 rue
@@ -2762,9 +2761,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
27622761 exp_env = env;
27632762 }
27642763 | Pexp_setfield (srecord , lid , snewval ) ->
2765- let record, label, opath =
2766- type_label_access ~context: None env srecord lid
2767- in
2764+ let record, label, opath = type_label_access env srecord lid in
27682765 let ty_record = if opath = None then newvar () else record.exp_type in
27692766 let label_loc, label, newval, _ =
27702767 type_label_exp ~context: (Some SetRecordField ) false env loc ty_record
@@ -2836,7 +2833,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
28362833 })
28372834 | Pexp_sequence (sexp1 , sexp2 ) ->
28382835 let exp1 = type_statement ~context: None env sexp1 in
2839- let exp2 = type_expect ~context env sexp2 ty_expected in
2836+ let exp2 = type_expect ~context: None env sexp2 ty_expected in
28402837 re
28412838 {
28422839 exp_desc = Texp_sequence (exp1, exp2);
@@ -2927,7 +2924,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
29272924 if separate then begin_def () ;
29282925 (* TODO: What should this be?*)
29292926 let type_clash_context = None in
2930- let arg = type_exp ~context env sarg in
2927+ let arg = type_exp ~context: None env sarg in
29312928 let gen =
29322929 if separate then (
29332930 end_def () ;
@@ -3202,8 +3199,8 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
32023199 | Pexp_jsx_element _ ->
32033200 failwith " Pexp_jsx_element is expected to be transformed at this point"
32043201
3205- and type_function ~ context ?in_function ~arity ~async loc attrs env ty_expected_
3206- l caselist =
3202+ and type_function ?in_function ~arity ~async loc attrs env ty_expected_ l
3203+ caselist =
32073204 let state = Warnings. backup () in
32083205 (* Disable Unerasable_optional_argument for uncurried functions *)
32093206 let unerasable_optional_argument =
@@ -3215,7 +3212,7 @@ and type_function ~context ?in_function ~arity ~async loc attrs env ty_expected_
32153212 | None -> ty_expected_
32163213 | Some arity ->
32173214 let fun_t = newty (Tarrow (l, newvar () , newvar () , Cok , Some arity)) in
3218- unify_exp_types ~context loc env fun_t ty_expected_;
3215+ unify_exp_types ~context: None loc env fun_t ty_expected_;
32193216 fun_t
32203217 in
32213218 let loc_fun, ty_fun =
@@ -3270,8 +3267,8 @@ and type_function ~context ?in_function ~arity ~async loc attrs env ty_expected_
32703267 exp_env = env;
32713268 }
32723269
3273- and type_label_access ~ context env srecord lid =
3274- let record = type_exp ~context ~recarg: Allowed env srecord in
3270+ and type_label_access env srecord lid =
3271+ let record = type_exp ~context: None ~recarg: Allowed env srecord in
32753272 let ty_exp = record.exp_type in
32763273 let opath =
32773274 try
@@ -3356,9 +3353,8 @@ and type_argument ~context ?recarg env sarg ty_expected' ty_expected =
33563353(* * This is ad-hoc translation for unifying specific primitive operations
33573354 See [Unified_ops] module for detailed explanation.
33583355 *)
3359- and translate_unified_ops ~ context (env : Env.t ) (funct : Typedtree.expression )
3356+ and translate_unified_ops (env : Env.t ) (funct : Typedtree.expression )
33603357 (sargs : sargs ) : (targs * Types.type_expr) option =
3361- ignore context;
33623358 match funct.exp_desc with
33633359 | Texp_ident (path , _ , _ ) -> (
33643360 let entry = Hashtbl. find_opt Unified_ops. index_by_path (Path. name path) in
@@ -3687,9 +3683,7 @@ and type_application ~context total_app env funct (sargs : sargs) :
36873683 in
36883684 (targs, ret_t, fully_applied)
36893685
3690- and type_construct ~context env loc lid sarg ty_expected attrs =
3691- (* TODO: Fix this *)
3692- ignore context;
3686+ and type_construct env loc lid sarg ty_expected attrs =
36933687 let opath =
36943688 try
36953689 let p0, p, _ = extract_concrete_variant env ty_expected in
0 commit comments