@@ -3308,9 +3308,14 @@ and type_expect_
3308
3308
unify_exp env (re exp) (instance ty_expected));
3309
3309
exp
3310
3310
in
3311
+ let ruem ~mode ~expected_mode exp =
3312
+ let exp = rue exp in
3313
+ submode ~env ~loc: exp.exp_loc mode expected_mode;
3314
+ exp
3315
+ in
3311
3316
match sexp.pexp_desc with
3312
3317
| Pexp_ident lid ->
3313
- let path, desc, kind = type_ident env expected_mode ~recarg lid in
3318
+ let path, mode, desc, kind = type_ident env ~recarg lid in
3314
3319
let exp_desc =
3315
3320
match desc.val_kind with
3316
3321
| Val_ivar (_ , cl_num ) ->
@@ -3330,7 +3335,7 @@ and type_expect_
3330
3335
| _ ->
3331
3336
Texp_ident (path, lid, desc, kind)
3332
3337
in
3333
- rue {
3338
+ ruem ~mode ~expected_mode {
3334
3339
exp_desc; exp_loc = loc; exp_extra = [] ;
3335
3340
exp_type = desc.val_type;
3336
3341
exp_mode = expected_mode.mode;
@@ -4680,9 +4685,8 @@ and type_expect_
4680
4685
exp_attributes = sexp.pexp_attributes;
4681
4686
exp_env = env }
4682
4687
4683
- and type_ident env expected_mode ?(recarg =Rejected ) lid =
4688
+ and type_ident env ?(recarg =Rejected ) lid =
4684
4689
let (path, desc, mode) = Env. lookup_value ~loc: lid.loc lid.txt env in
4685
- submode ~env ~loc: lid.loc mode expected_mode;
4686
4690
let is_recarg =
4687
4691
match (repr desc.val_type).desc with
4688
4692
| Tconstr (p , _ , _ ) -> Path. is_constructor_typath p
@@ -4708,12 +4712,13 @@ and type_ident env expected_mode ?(recarg=Rejected) lid =
4708
4712
ty, Id_prim mode
4709
4713
| _ ->
4710
4714
instance desc.val_type, Id_value in
4711
- path, { desc with val_type }, kind
4715
+ path, mode, { desc with val_type }, kind
4712
4716
4713
4717
and type_binding_op_ident env s =
4714
4718
let loc = s.loc in
4715
4719
let lid = Location. mkloc (Longident. Lident s.txt) loc in
4716
- let path, desc, kind = type_ident env mode_global lid in
4720
+ let path, mode, desc, kind = type_ident env lid in
4721
+ submode ~env ~loc: lid.loc mode mode_global;
4717
4722
let path =
4718
4723
match desc.val_kind with
4719
4724
| Val_ivar _ ->
0 commit comments