@@ -2380,14 +2380,14 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
23802380 [Vb. mk spat smatch]
23812381 sbody
23822382 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
23852385 [Exp. case pat body]
23862386 | Pexp_fun
23872387 {arg_label = l; default = None ; lhs = spat; rhs = sbody; arity; async} ->
23882388 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
23912391 [Ast_helper.Exp. case spat sbody]
23922392 | Pexp_apply {funct = sfunct ; args = sargs ; partial; transformed_jsx} ->
23932393 assert (sargs <> [] );
@@ -2401,7 +2401,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
24012401 let total_app = not partial in
24022402 let context = type_clash_context_from_function sexp sfunct in
24032403 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
24052405 | Some (targs , result_type ) -> (targs, result_type, true )
24062406 | None -> type_application ~context total_app env funct sargs
24072407 in
@@ -2499,8 +2499,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
24992499 exp_env = env;
25002500 }
25012501 | 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
25042503 | Pexp_variant (l , sarg ) -> (
25052504 (* Keep sharing *)
25062505 let ty_expected0 = instance env ty_expected in
@@ -2515,7 +2514,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
25152514 row_field_repr (List. assoc l row0.row_fields) )
25162515 with
25172516 | 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
25192518 re
25202519 {
25212520 exp_desc = Texp_variant (l, Some arg);
@@ -2745,7 +2744,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
27452744 exp_env = env;
27462745 }
27472746 | 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
27492748 let _, ty_arg, ty_res = instance_label false label in
27502749 unify_exp ~context: None env record ty_res;
27512750 rue
@@ -2758,9 +2757,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
27582757 exp_env = env;
27592758 }
27602759 | 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
27642761 let ty_record = if opath = None then newvar () else record.exp_type in
27652762 let label_loc, label, newval, _ =
27662763 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
28322829 })
28332830 | Pexp_sequence (sexp1 , sexp2 ) ->
28342831 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
28362833 re
28372834 {
28382835 exp_desc = Texp_sequence (exp1, exp2);
@@ -2923,7 +2920,7 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
29232920 if separate then begin_def () ;
29242921 (* TODO: What should this be?*)
29252922 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
29272924 let gen =
29282925 if separate then (
29292926 end_def () ;
@@ -3198,8 +3195,8 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
31983195 | Pexp_jsx_element _ ->
31993196 failwith " Pexp_jsx_element is expected to be transformed at this point"
32003197
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 =
32033200 let state = Warnings. backup () in
32043201 (* Disable Unerasable_optional_argument for uncurried functions *)
32053202 let unerasable_optional_argument =
@@ -3211,7 +3208,7 @@ and type_function ~context ?in_function ~arity ~async loc attrs env ty_expected_
32113208 | None -> ty_expected_
32123209 | Some arity ->
32133210 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_;
32153212 fun_t
32163213 in
32173214 let loc_fun, ty_fun =
@@ -3266,8 +3263,8 @@ and type_function ~context ?in_function ~arity ~async loc attrs env ty_expected_
32663263 exp_env = env;
32673264 }
32683265
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
32713268 let ty_exp = record.exp_type in
32723269 let opath =
32733270 try
@@ -3352,9 +3349,8 @@ and type_argument ~context ?recarg env sarg ty_expected' ty_expected =
33523349(* * This is ad-hoc translation for unifying specific primitive operations
33533350 See [Unified_ops] module for detailed explanation.
33543351 *)
3355- and translate_unified_ops ~ context (env : Env.t ) (funct : Typedtree.expression )
3352+ and translate_unified_ops (env : Env.t ) (funct : Typedtree.expression )
33563353 (sargs : sargs ) : (targs * Types.type_expr) option =
3357- ignore context;
33583354 match funct.exp_desc with
33593355 | Texp_ident (path , _ , _ ) -> (
33603356 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) :
36833679 in
36843680 (targs, ret_t, fully_applied)
36853681
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 =
36893683 let opath =
36903684 try
36913685 let p0, p, _ = extract_concrete_variant env ty_expected in
0 commit comments