@@ -2222,28 +2222,30 @@ type lazy_args =
22222222 (Asttypes.Noloc .arg_label * (unit -> Typedtree .expression ) option ) list
22232223
22242224type targs = (Asttypes.Noloc .arg_label * Typedtree .expression option ) list
2225- let rec type_exp ~context ?recarg env sexp =
2225+ let rec type_exp ? deprecated_context ~context ?recarg env sexp =
22262226 (* We now delegate everything to type_expect *)
2227- type_expect ~context ?recarg env sexp (newvar () )
2227+ type_expect ?deprecated_context ~context ?recarg env sexp (newvar () )
22282228
22292229(* Typing of an expression with an expected type.
22302230 This provide better error messages, and allows controlled
22312231 propagation of return type information.
22322232 In the principal case, [type_expected'] may be at generic_level.
22332233*)
22342234
2235- and type_expect ~context ?in_function ?recarg env sexp ty_expected =
2235+ and type_expect ?deprecated_context ~context ?in_function ?recarg env sexp
2236+ ty_expected =
22362237 let previous_saved_types = Cmt_format. get_saved_types () in
22372238 let exp =
22382239 Builtin_attributes. warning_scope sexp.pexp_attributes (fun () ->
2239- type_expect_ ~context ?in_function ?recarg env sexp ty_expected)
2240+ type_expect_ ?deprecated_context ~context ?in_function ?recarg env sexp
2241+ ty_expected)
22402242 in
22412243 Cmt_format. set_saved_types
22422244 (Cmt_format. Partial_expression exp :: previous_saved_types);
22432245 exp
22442246
2245- and type_expect_ ~context ?in_function ?(recarg = Rejected ) env sexp ty_expected
2246- =
2247+ and type_expect_ ? deprecated_context ~context ?in_function ?(recarg = Rejected )
2248+ env sexp ty_expected =
22472249 let loc = sexp.pexp_loc in
22482250 (* Record the expression type before unifying it with the expected type *)
22492251 let rue exp =
@@ -2260,7 +2262,9 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
22602262 in
22612263 match sexp.pexp_desc with
22622264 | Pexp_ident lid ->
2263- let path, desc = Typetexp. find_value env lid.loc lid.txt in
2265+ let path, desc =
2266+ Typetexp. find_value ?deprecated_context env lid.loc lid.txt
2267+ in
22642268 (if ! Clflags. annotations then
22652269 let dloc = desc.Types. val_loc in
22662270 let annot =
@@ -2398,7 +2402,9 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
23982402 assert (sargs <> [] );
23992403 begin_def () ;
24002404 (* one more level for non-returning functions *)
2401- let funct = type_exp ~context: None env sfunct in
2405+ let funct =
2406+ type_exp ~deprecated_context: FunctionCall ~context: None env sfunct
2407+ in
24022408 let ty = instance env funct.exp_type in
24032409 end_def () ;
24042410 wrap_trace_gadt_instances env (lower_args env [] ) ty;
0 commit comments