|
@@ -10,6 +10,7 @@ open DisplayOutput
|
|
open Json
|
|
open Json
|
|
|
|
|
|
exception Dirty of module_def
|
|
exception Dirty of module_def
|
|
|
|
+exception ServerError of string
|
|
|
|
|
|
let measure_times = ref false
|
|
let measure_times = ref false
|
|
let prompt = ref false
|
|
let prompt = ref false
|
|
@@ -300,6 +301,16 @@ let rec wait_loop process_params verbose accept =
|
|
| MCode -> check_module_shadowing com2 directories m
|
|
| MCode -> check_module_shadowing com2 directories m
|
|
| MMacro when ctx.Typecore.in_macro -> check_module_shadowing com2 directories m
|
|
| MMacro when ctx.Typecore.in_macro -> check_module_shadowing com2 directories m
|
|
| MMacro ->
|
|
| MMacro ->
|
|
|
|
+ (*
|
|
|
|
+ Creating another context while the previous one is incomplete means we have an infinite loop in the compiler.
|
|
|
|
+ Most likely because of circular dependencies in base modules (e.g. `StdTypes` or `String`)
|
|
|
|
+ Prevents spending another 5 hours for debugging.
|
|
|
|
+ @see https://github.com/HaxeFoundation/haxe/issues/8174
|
|
|
|
+ *)
|
|
|
|
+ if not ctx.g.complete then
|
|
|
|
+ raise (ServerError ("Infinite loop in Haxe server detected. "
|
|
|
|
+ ^ "Probably caused by shadowing a module of the standard library. "
|
|
|
|
+ ^ "Make sure shadowed module does not pull macro context."));
|
|
let _, mctx = MacroContext.get_macro_context ctx p in
|
|
let _, mctx = MacroContext.get_macro_context ctx p in
|
|
check_module_shadowing mctx.Typecore.com (get_changed_directories mctx) m
|
|
check_module_shadowing mctx.Typecore.com (get_changed_directories mctx) m
|
|
in
|
|
in
|