@@ -1105,7 +1105,8 @@ and type_expect_ =
11051105 loc,
11061106 closed,
11071107 env,
1108- (e, k) => k(type_label_exp(true , env, loc, ty_record, e)),
1108+ (e, k) =>
1109+ k(type_label_exp(~in_function, true , env, loc, ty_record, e)),
11091110 opath,
11101111 es,
11111112 ),
@@ -1422,6 +1423,7 @@ and type_expect_ =
14221423 });
14231424 | PExpConstruct (cstr , arg ) =>
14241425 type_construct(
1426+ ~in_function,
14251427 env,
14261428 loc,
14271429 cstr,
@@ -2098,7 +2100,8 @@ and type_application = (~in_function=?, ~loc, env, funct, sargs) => {
20982100 (ordered_labels, omitted_args @ typed_args, instance(env, ty_ret));
20992101}
21002102
2101- and type_construct = (env, loc, lid, sarg, ty_expected_explained, attrs) => {
2103+ and type_construct =
2104+ (~in_function, env, loc, lid, sarg, ty_expected_explained, attrs) => {
21022105 let {ty: ty_expected , explanation} = ty_expected_explained;
21032106 let (sargs , is_record_cstr ) =
21042107 switch (sarg) {
@@ -2215,7 +2218,7 @@ and type_construct = (env, loc, lid, sarg, ty_expected_explained, attrs) => {
22152218 let args =
22162219 List . map2(
22172220 (sarg, (ty_arg, ty_arg0)) =>
2218- type_argument(~recarg, env, sarg, ty_arg, ty_arg0),
2221+ type_argument(~in_function ? , ~ recarg, env, sarg, ty_arg, ty_arg0),
22192222 sargs,
22202223 List . combine(ty_args, ty_args0),
22212224 );
@@ -2725,7 +2728,8 @@ and type_label_access = (env, srecord, lid) => {
27252728 (record, label, opath);
27262729}
27272730
2728- and type_label_exp = (create, env, loc, ty_expected, (lid, label, sarg)) => {
2731+ and type_label_exp =
2732+ (~in_function, create, env, loc, ty_expected, (lid, label, sarg)) => {
27292733 /* Here also ty_expected may be at generic_level */
27302734 begin_def() ;
27312735 let separate = Env . has_local_constraints(env);
@@ -2758,7 +2762,8 @@ and type_label_exp = (create, env, loc, ty_expected, (lid, label, sarg)) => {
27582762 } else {
27592763 Some (Btype . snapshot() );
27602764 };
2761- let arg = type_argument(env, sarg, ty_arg, instance(env, ty_arg));
2765+ let arg =
2766+ type_argument(~in_function? , env, sarg, ty_arg, instance(env, ty_arg));
27622767 end_def() ;
27632768 try (
27642769 {
0 commit comments