···170170 ; expected_type : type_expr
171171 ; explanation : type_forcing_context option
172172 }
173173- | Scoping_let_module of string * type_expr
174173 | Not_a_polymorphic_variant_type of Longident.t
175174 | Incoherent_label_order
176175 | Less_general of string * Errortrace.unification_error
···22802279 in
22812280 List.fold_left (fun env { mv_id; mv_loc; mv_name; mv_uid } ->
22822281 Typetexp.TyVarEnv.with_local_scope begin fun () ->
22832283- (* This code is parallel to the typing of Pexp_letmodule. However we
22842284- omit the call to [Mtype.lower_nongen] as it's not necessary here.
22852285- For Pexp_letmodule, the call to [type_module] is done in a raised
22862286- level and so needs to be modified to have the correct, outer level.
22872287- Here, on the other hand, we're calling [type_module] outside the
22882288- raised level, so there's no extra step to take.
22892289- *)
22902282 let modl, md_shape =
22912283 !type_module env
22922284 Ast_helper.(
···73127304 (label ~long:true) got
73137305 (if second_long then "being " else "")
73147306 (label ~long:second_long) expected
73157315- | Scoping_let_module(id, ty) ->
73167316- Location.errorf ~loc
73177317- "This %a expression has type@ %a@ \
73187318- In this type, the locally bound module name %a escapes its scope"
73197319- Style.inline_code "let module"
73207320- (Style.as_inline_code Printtyp.type_expr) ty
73217321- Style.inline_code id
73227307 | Private_type ty ->
73237308 Location.errorf ~loc "Cannot create values of the private type %a"
73247309 (Style.as_inline_code Printtyp.type_expr) ty
···30723072 | Lapply _ -> assert false
3073307330743074let type_package env m pack =
30753075- (* Same as Pexp_letmodule *)
30763075 let modl, scope =
30773076 Typetexp.TyVarEnv.with_local_scope begin fun () ->
30783077 (* type the module and create a scope in a raised level *)