Răsfoiți Sursa

Fix stack overflow issue (#10933)

* Fix stack overflow issue

* rerun post processing when adding generics type parameter dependencies

* Fix 8748 windows test

* restore previous behavior as much as possible to play it safe

typeloadModule.loadModule is the one that needs changed behavior

* invert flag to reflect the common use case
Rudy Ges 2 ani în urmă
părinte
comite
59cc17059c
3 a modificat fișierele cu 6 adăugiri și 4 ștergeri
  1. 2 2
      src/core/tFunctions.ml
  2. 3 1
      src/typing/macroContext.ml
  3. 1 1
      src/typing/typeloadModule.ml

+ 2 - 2
src/core/tFunctions.ml

@@ -230,11 +230,11 @@ let null_abstract = {
 	a_enum = false;
 }
 
-let add_dependency m mdep =
+let add_dependency ?(skip_postprocess=false) m mdep =
 	if m != null_module && m != mdep then begin
 		m.m_extra.m_deps <- PMap.add mdep.m_id mdep m.m_extra.m_deps;
 		(* In case the module is cached, we'll have to run post-processing on it again (issue #10635) *)
-		m.m_extra.m_processed <- 0
+		if not skip_postprocess then m.m_extra.m_processed <- 0
 	end
 
 let arg_name (a,_) = a.v_name

+ 3 - 1
src/typing/macroContext.ml

@@ -455,7 +455,9 @@ and flush_macro_context mint ctx =
 		let's save the minimal amount of information we need
 	*)
 	let minimal_restore t =
-		(t_infos t).mt_module.m_extra.m_processed <- mctx.com.compilation_step;
+		if (t_infos t).mt_module.m_extra.m_processed = 0 then
+			(t_infos t).mt_module.m_extra.m_processed <- mctx.com.compilation_step;
+
 		match t with
 		| TClassDecl c ->
 			let mk_field_restore f =

+ 1 - 1
src/typing/typeloadModule.ml

@@ -825,7 +825,7 @@ let load_module' ctx g m p =
 
 let load_module ctx m p =
 	let m2 = load_module' ctx ctx.g m p in
-	add_dependency ctx.m.curmod m2;
+	add_dependency ~skip_postprocess:true ctx.m.curmod m2;
 	if ctx.pass = PTypeField then flush_pass ctx PConnectField "load_module";
 	m2