Explorar o código

always add core types to default imports so they are available from macros (closes #3131, closes #3154, see #1904)

Simon Krajewski %!s(int64=11) %!d(string=hai) anos
pai
achega
5bb945c557
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      typer.ml

+ 2 - 2
typer.ml

@@ -4031,8 +4031,6 @@ let make_macro_api ctx p =
 		Interp.on_generate = (fun f ->
 			Common.add_filter ctx.com (fun() ->
 				let t = macro_timer ctx "onGenerate" in
-				(* add standard types to current module so basic types can be resolved (issue #1904) *)
-				ctx.m.module_types <- ctx.m.module_types @ ctx.g.std.m_types;
 				f (List.map make_instance ctx.com.types);
 				t()
 			)
@@ -4625,6 +4623,8 @@ let rec create com =
 	with
 		Error (Module_not_found ([],"StdTypes"),_) -> error "Standard library not found" null_pos
 	);
+	(* We always want core types to be available so we add them as default imports (issue #1904 and #3131). *)
+	ctx.m.module_types <- ctx.g.std.m_types;
 	List.iter (fun t ->
 		match t with
 		| TAbstractDecl a ->