|
@@ -490,7 +490,13 @@ let make_macro_api ctx mctx p =
|
|
let mpath = Ast.parse_path m in
|
|
let mpath = Ast.parse_path m in
|
|
begin try
|
|
begin try
|
|
let m = ctx.com.module_lut#find mpath in
|
|
let m = ctx.com.module_lut#find mpath in
|
|
- ignore(TypeloadModule.type_types_into_module ctx.com ctx.g m types pos)
|
|
|
|
|
|
+ if m != ctx.m.curmod then begin
|
|
|
|
+ let pos = { pfile = (Path.UniqueKey.lazy_path m.m_extra.m_file); pmin = 0; pmax = 0 } in
|
|
|
|
+ raise_typing_error_ext (make_error ~sub:[
|
|
|
|
+ make_error ~depth:1 (Custom "Previously defined here") pos
|
|
|
|
+ ] (Custom (Printf.sprintf "Cannot redefine module %s" (s_type_path mpath))) p);
|
|
|
|
+ end else
|
|
|
|
+ ignore(TypeloadModule.type_types_into_module ctx.com ctx.g m types pos)
|
|
with Not_found ->
|
|
with Not_found ->
|
|
let mnew = TypeloadModule.type_module ctx.com ctx.g mpath (ctx.com.file_keys#generate_virtual ctx.com.compilation_step) types pos in
|
|
let mnew = TypeloadModule.type_module ctx.com ctx.g mpath (ctx.com.file_keys#generate_virtual ctx.com.compilation_step) types pos in
|
|
mnew.m_extra.m_kind <- MFake;
|
|
mnew.m_extra.m_kind <- MFake;
|