Sfoglia il codice sorgente

clean up against development

Simon Krajewski 1 anno fa
parent
commit
388f34c90c

+ 1 - 2
src/compiler/displayProcessing.ml

@@ -48,8 +48,7 @@ let handle_display_argument_old com file_pos actx =
 			| "diagnostics" ->
 				com.report_mode <- RMLegacyDiagnostics [file_unique];
 				let dm = create DMNone in
-				{dm with dms_display_file_policy = DFPAlso; dms_per_file = true; dms_populate_cache = false}
-				(* {dm with dms_display_file_policy = DFPAlso; dms_per_file = true; dms_populate_cache = !ServerConfig.populate_cache_from_display} *)
+				{dm with dms_display_file_policy = DFPAlso; dms_per_file = true; dms_populate_cache = !ServerConfig.populate_cache_from_display}
 			| "statistics" ->
 				com.report_mode <- RMStatistics;
 				let dm = create DMNone in

+ 1 - 1
src/compiler/server.ml

@@ -241,7 +241,7 @@ let rec find_or_restore_module cs sign sctx ctx path =
 	(* TODO pos *)
 
 	let load_module path sign =
-		let m = TypeloadModule.do_type_module ctx ctx.g path null_pos in
+		let m = TypeloadModule.load_module ctx path null_pos in
 		assert (m.m_extra.m_sign = sign);
 		m
 	in

+ 0 - 5
src/context/display/diagnostics.ml

@@ -147,11 +147,6 @@ let prepare com =
 		unresolved_identifiers = [];
 		missing_fields = PMap.empty;
 	} in
-	(* TODO why is this check failing with hxb? *)
-	List.iter (fun diag ->
-		trace (Printf.sprintf "kind: %d" (MessageSeverity.to_int diag.diag_severity));
-		MessageReporting.display_source_at com diag.diag_pos;
-	) com.shared.shared_display_information.diagnostics_messages;
 	if not (List.exists (fun diag -> diag.diag_severity = MessageSeverity.Error) com.shared.shared_display_information.diagnostics_messages) then
 		collect_diagnostics dctx com;
 	let process_modules com =

+ 9 - 17
src/context/display/displayJson.ml

@@ -44,14 +44,11 @@ let send_string j =
 let send_json json =
 	send_string (string_of_json json)
 
-class display_handler (jsonrpc : jsonrpc_handler) com = object(self)
-	val cs = com.cs;
+class display_handler (jsonrpc : jsonrpc_handler) com (cs : CompilationCache.t) = object(self)
+	val cs = cs;
 
 	method get_cs = cs
 
-	method maybe_get_macro_cs =
-		Option.map (fun com -> com.cs) (com.get_macros())
-
 	method enable_display mode =
 		com.display <- create mode;
 		Parser.display_mode := mode;
@@ -166,7 +163,7 @@ let handler =
 
 			(match hctx.com.file_contents with
 			| [file, None] ->
-				hctx.com.display <- { hctx.com.display with dms_display_file_policy = DFPAlso; dms_per_file = true; dms_populate_cache = false};
+				hctx.com.display <- { hctx.com.display with dms_display_file_policy = DFPAlso; dms_per_file = true; dms_populate_cache = !ServerConfig.populate_cache_from_display};
 			| _ -> ());
 		);
 		"display/implementation", (fun hctx ->
@@ -385,16 +382,9 @@ let handler =
 			let file = hctx.jsonrpc#get_string_param "file" in
 			let fkey = hctx.com.file_keys#get file in
 			let cs = hctx.display#get_cs in
-			(* TODO: better way to restore macro context? *)
-			hctx.com.callbacks#add_after_init_macros (fun () ->
-				cs#taint_modules fkey "server/invalidate";
-				cs#remove_files fkey;
-				Option.may (fun mcs ->
-					mcs#taint_modules fkey "server/invalidate";
-					mcs#remove_files fkey
-				) hctx.display#maybe_get_macro_cs;
-				hctx.send_result jnull
-			)
+			cs#taint_modules fkey "server/invalidate";
+			cs#remove_files fkey;
+			hctx.send_result jnull
 		);
 		"server/configure", (fun hctx ->
 			let l = ref (List.map (fun (name,value) ->
@@ -492,7 +482,9 @@ let parse_input com input report_times =
 		jsonrpc = jsonrpc
 	});
 
-	let display = new display_handler jsonrpc com in
+	let cs = com.cs in
+
+	let display = new display_handler jsonrpc com cs in
 
 	let hctx = {
 		com = com;

+ 1 - 25
src/core/abstract.ml

@@ -20,31 +20,7 @@ let find_cast_field uctx find =
 		| None -> raise Not_found
 
 let find_field_from uctx a b ab tl =
-	(* (match b with *)
-	(* | TAbstract ({a_path = (["alchimix";"utils"],"Set")}, _) -> *)
-	(* 	(1* Globals.trace (s_type_kind b); *1) *)
-	(* 	(1* Globals.trace (s_type_kind a); *1) *)
-	(* 	(1* Globals.trace (Printf.sprintf "Has %d @:from fields" (List.length ab.a_from_field)); *1) *)
-
-	(* 	Globals.do_trace' := true; *)
-	(* 	let res = List.find_all (unifies_from_field uctx a b ab tl) ab.a_from_field in *)
-	(* 	Globals.do_trace' := false; *)
-	(* 	Globals.trace (Printf.sprintf "Found %d compatible @:from" (List.length res)); *)
-
-	(* 	(1* let (t,cf) = List.hd ab.a_from_field in *1) *)
-
-	(* 	(1* Globals.trace (s_type_kind (follow_lazy t)); (2* TLazy *2) *1) *)
-	(* 	(1* List.iter (fun cp -> *1) *)
-	(* 	(1* 	Globals.trace cp.ttp_name; (2* T *2) *1) *)
-	(* 	(1* 	Globals.trace (s_type_kind cp.ttp_type) (2* TInst(fromArray.T, []) *2) *1) *)
-	(* 	(1* ) cf.cf_params; *1) *)
-
-	(* 	(1* (t,cf) *1) *)
-	(* 	List.find (unifies_from_field uctx a b ab tl) ab.a_from_field *)
-	(* | _ -> *)
-		(* ()); *)
-		List.find (unifies_from_field uctx a b ab tl) ab.a_from_field
-	(* ) *)
+	List.find (unifies_from_field uctx a b ab tl) ab.a_from_field
 
 let find_field_to uctx a b ab tl =
 	List.find (unifies_to_field uctx a b ab tl) ab.a_to_field

+ 13 - 23
src/core/define.ml

@@ -141,37 +141,27 @@ let raw_undefine ctx k =
 let define ctx k =
 	raw_define_value ctx (get_define_key k) "1"
 
-let get_signature_raw def =
-	let defines = PMap.foldi (fun k v acc ->
-		(* don't make much difference between these special compilation flags *)
-		match String.concat "_" (ExtString.String.nsplit k "-") with
-		(* If we add something here that might be used in conditional compilation it should be added to
-			 Parser.parse_macro_ident as well (issue #5682).
-			 Note that we should removed flags like use_rtti_doc here.
-		*)
-		| "display" | "use_rtti_doc" | "macro_times" | "display_details" | "no_copt" | "display_stdin"
-		| "message.reporting" | "message.log_file" | "message.log_format" | "message.no_color"
-		| "dump" | "dump_dependencies" | "dump_ignore_var_ids" -> acc
-		| _ -> (k ^ "=" ^ v) :: acc
-	) def.values [] in
-	String.concat "@" (List.sort compare defines)
-
-let digest_tbl = Hashtbl.create 0
-
 let get_signature def =
 	match def.defines_signature with
 	| Some s -> s
 	| None ->
-		let str = get_signature_raw def in
-		(* Printf.eprintf "Defines: %s\n" str; *)
+		let defines = PMap.foldi (fun k v acc ->
+			(* don't make much difference between these special compilation flags *)
+			match String.concat "_" (ExtString.String.nsplit k "-") with
+			(* If we add something here that might be used in conditional compilation it should be added to
+			   Parser.parse_macro_ident as well (issue #5682).
+			   Note that we should removed flags like use_rtti_doc here.
+			*)
+			| "display" | "use_rtti_doc" | "macro_times" | "display_details" | "no_copt" | "display_stdin"
+			| "message.reporting" | "message.log_file" | "message.log_format" | "message.no_color"
+			| "dump" | "dump_dependencies" | "dump_ignore_var_ids" -> acc
+			| _ -> (k ^ "=" ^ v) :: acc
+		) def.values [] in
+		let str = String.concat "@" (List.sort compare defines) in
 		let s = Digest.string str in
 		def.defines_signature <- Some s;
-		Hashtbl.add digest_tbl s str;
 		s
 
-let retrieve_defines sign =
-	try Hashtbl.find digest_tbl sign with Not_found -> (Printf.sprintf "[cannot find defines for sign %s]" sign)
-
 let deprecation_lut =
 	let h = Hashtbl.create 0 in
 	List.iter (fun (name,reason) ->

+ 0 - 5
src/core/tFunctions.ml

@@ -481,8 +481,6 @@ let apply_params ?stack cparams params t =
 				t
 			end
 		| TInst (c,tl) ->
-			(* let spath = (s_type_path c.cl_path) in *)
-			(* if spath = "alchimix.utils.Set.T" || spath = "fromArray.T" then trace' spath; *)
 			(match tl with
 			| [] ->
 				t
@@ -726,9 +724,6 @@ let rec module_type_of_type = function
 		| _ -> raise Exit)
 	| _ ->
 		raise Exit
-	(* | TFun of tsignature *)
-	(* | TAnon of tanon *)
-	(* | TDynamic of t option *)
 
 let tconst_to_const = function
 	| TInt i -> Int (Int32.to_string i, None)

+ 6 - 18
src/filters/exceptions.ml

@@ -527,15 +527,10 @@ let filter tctx =
 			| TInst(cls,_) as t -> t,cls
 			| _ -> raise_typing_error "haxe.ValueException is expected to be a class" null_pos
 		and haxe_native_stack_trace =
-			(* trace "TODO: add NativeStackTrace as dependency?"; *)
-			let t,cls = match Typeload.load_instance tctx (tp (["haxe"],"NativeStackTrace")) ParamSpawnMonos with
-			| TInst(cls,_) as t -> (t,cls)
-			| TAbstract({ a_impl = Some cls },_) as t -> (t,cls)
-			| _ ->
-				raise_typing_error "haxe.NativeStackTrace is expected to be a class or an abstract" null_pos
-			in
-			add_dependency ~skip_postprocess:true tctx.m.curmod (t_infos (module_type_of_type t)).mt_module;
-			cls
+			match Typeload.load_instance tctx (tp (["haxe"],"NativeStackTrace")) ParamSpawnMonos with
+			| TInst(cls,_) -> cls
+			| TAbstract({ a_impl = Some cls },_) -> cls
+			| _ -> raise_typing_error "haxe.NativeStackTrace is expected to be a class or an abstract" null_pos
 		in
 		let is_path_of_dynamic (pack,name) =
 			name = "Dynamic" && (pack = [] || pack = ["StdTypes"])
@@ -577,19 +572,12 @@ let filter tctx =
 	Inserts `haxe.NativeStackTrace.saveStack(e)` in non-haxe.Exception catches.
 *)
 let insert_save_stacks tctx =
-	(* TODO? *)
-	(* trace(Printf.sprintf "Has exception stack = %b" (has_feature tctx.com "haxe.NativeStackTrace.exceptionStack")); *)
-
 	if not (has_feature tctx.com "haxe.NativeStackTrace.exceptionStack") then
 		(fun e -> e)
 	else
 		let native_stack_trace_cls =
-			(* let tp = mk_type_path (["haxe"],"NativeStackTrace") in *)
-			(* match Typeload.load_type_def tctx null_pos tp with *)
-			(* TODO might not want to go directly to hxb restore? *)
-			let check _ _ _ = None in
-			let load _ _ = raise Not_found in
-			match HxbRestore.find_type tctx.com.cs (CommonCache.get_cache_sign tctx.com) tctx.com load check (["haxe"], "NativeStackTrace") null_pos with
+			let tp = mk_type_path (["haxe"],"NativeStackTrace") in
+			match Typeload.load_type_def tctx null_pos tp with
 			| TClassDecl cls -> cls
 			| TAbstractDecl { a_impl = Some cls } -> cls
 			| _ -> raise_typing_error "haxe.NativeStackTrace is expected to be a class or an abstract" null_pos

+ 1 - 1
src/typing/generic.ml

@@ -175,7 +175,7 @@ let static_method_container gctx c cf p =
 		| TInst(cg,_) -> cg
 		| _ -> raise_typing_error ("Cannot specialize @:generic static method because the generated type name is already used: " ^ name) p
 	with Error { err_message = Module_not_found path } when path = (pack,name) ->
-		let m = (try ctx.com.module_lut#find (ctx.com.type_to_module#find c.cl_path) with Not_found -> die "" __LOC__) in
+		let m = c.cl_module in
 		let mg = {
 			m_id = alloc_mid();
 			m_path = (pack,name);

+ 0 - 1
src/typing/typeloadCheck.ml

@@ -344,7 +344,6 @@ let check_module_types ctx m p t =
 		let hex2 = Digest.to_hex m2.m_extra.m_sign in
 		let s = if hex1 = hex2 then hex1 else Printf.sprintf "was %s, is %s" hex2 hex1 in
 		raise_typing_error (Printf.sprintf "Type name %s is redefined from module %s (%s)" (s_type_path t.mt_path)  (s_type_path path2) s) p
-		(* ctx.com.warning WInfo [] (Printf.sprintf "Type name %s is redefined from module %s (%s)" (s_type_path t.mt_path)  (s_type_path path2) s) p; *)
 	with
 		Not_found ->
 			ctx.com.type_to_module#add t.mt_path m.m_path

+ 44 - 83
src/typing/typeloadModule.ml

@@ -43,21 +43,8 @@ let field_of_static_definition d p =
 		cff_kind = d.d_data;
 	}
 
-let do_add_module com m =
-	let sign = CommonCache.get_cache_sign com in
-	if m.m_extra.m_sign <> sign then begin
-		trace (Printf.sprintf "Adding module %s with a different sign!" (s_type_path m.m_path));
-		trace (Define.retrieve_defines sign);
-		trace (Define.retrieve_defines m.m_extra.m_sign);
-	end else begin
-		match m.m_extra.m_cache_state with
-		| MSBad _ ->
-			trace (Printf.sprintf "[typeloadModule] Trying to add module %s with state %s" (s_type_path m.m_path) (Printer.s_module_cache_state m.m_extra.m_cache_state));
-		| _ -> com.module_lut#add m.m_path m
-	end
-
 module ModuleLevel = struct
-	let make_module ctx mpath file =
+	let make_module ctx mpath file loadp =
 		let m = {
 			m_id = alloc_mid();
 			m_path = mpath;
@@ -69,7 +56,7 @@ module ModuleLevel = struct
 
 	let add_module ctx m p =
 		List.iter (TypeloadCheck.check_module_types ctx m p) m.m_types;
-		do_add_module ctx.com m
+		ctx.com.module_lut#add m.m_path m
 
 	(*
 		Build module structure : should be atomic - no type loading is possible
@@ -297,7 +284,7 @@ module ModuleLevel = struct
 		let make_import_module path r =
 			com.parser_cache#add path r;
 			(* We use the file path as module name to make it unique. This may or may not be a good idea... *)
-			let m_import = make_module ctx ([],path) path in
+			let m_import = make_module ctx ([],path) path p in
 			m_import.m_extra.m_kind <- MImport;
 			m_import
 		in
@@ -314,9 +301,9 @@ module ModuleLevel = struct
 						| ParseError(_,(msg,p),_) -> Parser.error msg p
 					in
 					List.iter (fun (d,p) -> match d with EImport _ | EUsing _ -> () | _ -> raise_typing_error "Only import and using is allowed in import.hx files" p) r;
-					let mimport = make_import_module path r in
-					add_module ctx mimport p;
-					add_dependency m mimport;
+					let m_import = make_import_module path r in
+					add_module ctx m_import p;
+					add_dependency m m_import;
 					r
 				end else begin
 					let r = [] in
@@ -783,8 +770,8 @@ let type_types_into_module ctx m tdecls p =
 	Creates a new module and types [tdecls] into it.
 *)
 let type_module ctx mpath file ?(dont_check_path=false) ?(is_extern=false) tdecls p =
-	let m = ModuleLevel.make_module ctx mpath file in
-	do_add_module ctx.com m;
+	let m = ModuleLevel.make_module ctx mpath file p in
+	ctx.com.module_lut#add m.m_path m;
 	let tdecls = ModuleLevel.handle_import_hx ctx m tdecls p in
 	let ctx = type_types_into_module ctx m tdecls p in
 	if is_extern then m.m_extra.m_kind <- MExtern else if not dont_check_path then Typecore.check_module_path ctx m.m_path p;
@@ -798,14 +785,14 @@ let type_module_hook = ref (fun _ _ _ -> None)
 
 let rec get_reader ctx g p =
 	let make_module path file =
-		let m = ModuleLevel.make_module ctx path file in
+		let m = ModuleLevel.make_module ctx path file p in
 		(* m.m_extra.m_added <- ctx.com.compilation_step; *)
 		m.m_extra.m_processed <- 1;
 		m
 	in
 
 	let add_module m =
-		do_add_module ctx.com m;
+		ctx.com.module_lut#add m.m_path m
 	in
 
 	let flush_fields () =
@@ -854,62 +841,42 @@ and load_hxb_module ctx g path p =
 		close_in ch;
 		raise e
 
-and do_type_module ctx g mpath p =
-	let raise_not_found () = raise_error_msg (Module_not_found mpath) p in
-	if ctx.com.module_nonexistent_lut#mem mpath then raise_not_found();
-	if ctx.g.load_only_cached_modules then raise_not_found();
-	let is_extern = ref false in
-	let file, decls = try
-		(* Try parsing *)
-		TypeloadParse.parse_module ctx mpath p
-	with Not_found ->
-		(* Nothing to parse, try loading extern type *)
-		let rec loop = function
-			| [] ->
-				ctx.com.module_nonexistent_lut#add mpath true;
-				raise_not_found()
-			| (file,load) :: l ->
-				match load mpath p with
-				| None -> loop l
-				| Some (_,a) -> file, a
-		in
-		is_extern := true;
-		loop ctx.com.load_extern_type
-	in
-	let is_extern = !is_extern in
+and load_module' ctx g m p =
 	try
-		type_module ctx mpath file ~is_extern decls p
-	with Forbid_package (inf,pl,pf) when p <> null_pos ->
-		raise (Forbid_package (inf,p::pl,pf))
-
-and do_load_module' ctx g mpath p =
-	(* Check cache *)
-	match !type_module_hook ctx mpath p with
-	| Some m ->
-		(* ctx.com.module_lut#add mpath m; *)
-		(* do_add_module ctx.com m; *)
-		m
-	(* Try loading from hxb first, then from source *)
-	| None -> try load_hxb_module ctx g mpath p with Not_found ->
-		do_type_module ctx g mpath p
-
-and load_module' ctx g mpath p =
-	try begin
 		(* Check current context *)
-		let m = ctx.com.module_lut#find mpath in
-		(* (match m.m_extra.m_cache_state with *)
-		(* 	| MSBad reason -> *)
-		(* 		trace (Printf.sprintf "com.module_lut has dirty module %s ?!" (s_type_path mpath)); *)
-		(* 		(1* ctx.com.module_lut#remove mpath; *1) *)
-		(* 		(1* self#maybe_remove_dirty path; *1) *)
-		(* 		(1* self#remove_dirty_dep (DependencyDirty (path, reason)); *1) *)
-		(* 		raise (Bad_module (mpath, reason)) *)
-		(* 		(1* raise Not_found *1) *)
-		(* 	| _ -> () *)
-		(* ); *)
-		m
-	end with Not_found ->
-		do_load_module' ctx g mpath p
+		ctx.com.module_lut#find m
+	with Not_found ->
+		(* Check cache *)
+		match !type_module_hook ctx m p with
+		| Some m ->
+			m
+		| None -> try load_hxb_module ctx g m p with Not_found ->
+			let raise_not_found () = raise_error_msg (Module_not_found m) p in
+			if ctx.com.module_nonexistent_lut#mem m then raise_not_found();
+			if ctx.g.load_only_cached_modules then raise_not_found();
+			let is_extern = ref false in
+			let file, decls = try
+				(* Try parsing *)
+				TypeloadParse.parse_module ctx m p
+			with Not_found ->
+				(* Nothing to parse, try loading extern type *)
+				let rec loop = function
+					| [] ->
+						ctx.com.module_nonexistent_lut#add m true;
+						raise_not_found()
+					| (file,load) :: l ->
+						match load m p with
+						| None -> loop l
+						| Some (_,a) -> file, a
+				in
+				is_extern := true;
+				loop ctx.com.load_extern_type
+			in
+			let is_extern = !is_extern in
+			try
+				type_module ctx m file ~is_extern decls p
+			with Forbid_package (inf,pl,pf) when p <> null_pos ->
+				raise (Forbid_package (inf,p::pl,pf))
 
 let load_module ctx m p =
 	let m2 = load_module' ctx ctx.g m p in
@@ -921,10 +888,4 @@ let load_module ctx m p =
 	let timer = Timer.timer ["typing";"load_module"] in
 	Std.finally timer (load_module ctx m) p *)
 
-(* Same as load_module, but skips ctx.com.module_lut *)
-let do_load_module ctx m p =
-	let m2 = do_load_module' ctx ctx.g m p in
-	if ctx.pass = PTypeField then flush_pass ctx PConnectField ("load_module",fst m @ [snd m]);
-	m2
-
 ;;

+ 0 - 1
src/typing/typeloadParse.ml

@@ -297,7 +297,6 @@ let parse_module' com m p =
 	file,remap,pack,decls
 
 let parse_module ctx m p =
-	(* trace (Printf.sprintf "parse_module %s" (s_type_path m)); *)
 	let file,remap,pack,decls = parse_module' ctx.com m p in
 	if pack <> !remap then begin
 		let spack m = if m = [] then "`package;`" else "`package " ^ (String.concat "." m) ^ ";`" in

+ 1 - 3
std/hl/_std/Reflect.hx

@@ -133,9 +133,7 @@ class Reflect {
 	@:overload(function(f:Array<Dynamic>->Void):Dynamic {})
 	extern public static function makeVarArgs(f:Array<Dynamic>->Dynamic):Dynamic;
 
-	@:keep
-	// @:ifFeature("Reflect.makeVarArgs")
-	static function _makeVarArgs(f:Array<Dynamic>->Dynamic):Dynamic {
+	@:ifFeature("Reflect.makeVarArgs") static function _makeVarArgs(f:Array<Dynamic>->Dynamic):Dynamic {
 		return hl.Api.makeVarArgs(function(args:hl.NativeArray<Dynamic>) {
 			var arr = hl.types.ArrayDyn.alloc(hl.types.ArrayObj.alloc(args), true);
 			return f(cast arr);

+ 2 - 0
tests/display/src/cases/IImport.hx

@@ -28,6 +28,7 @@ class IImport extends DisplayTestCase {
 		eq(true, hasPath(fields(pos(1)), "Serializer"));
 	}
 
+	#if HXB_PERFECT
 	/**
 		import haxe.Serializer.{-1-}
 	**/
@@ -35,6 +36,7 @@ class IImport extends DisplayTestCase {
 		eq(true, hasPath(fields(pos(1)), "run"));
 		eq(true, hasPath(fields(pos(1)), "Serializer"));
 	}
+	#end
 
 	/**
 		using ha{-1-}xe.{-5-}ma{-2-}cro.{-6-}Exp{-3-}rTools.{-7-}Expr{-4-}ArrayTools;

+ 4 - 4
tests/display/src/cases/Issue9142.hx

@@ -37,7 +37,7 @@ class Issue9142 extends DisplayTestCase {
 		}
 	**/
 	function testPrivateImport() {
-		// eq("String", type(pos(1)));
+		eq("String", type(pos(1)));
 	}
 
 	/**
@@ -63,7 +63,7 @@ class Issue9142 extends DisplayTestCase {
 		}
 	**/
 	function testNonExistentSubtypeImport() {
-		// eq("String", type(pos(1)));
+		eq("String", type(pos(1)));
 	}
 
 	/**
@@ -128,7 +128,7 @@ class Issue9142 extends DisplayTestCase {
 		}
 	**/
 	function testTooMuchImport() {
-		// eq("String", type(pos(1)));
+		eq("String", type(pos(1)));
 	}
 
 	/**
@@ -141,7 +141,7 @@ class Issue9142 extends DisplayTestCase {
 		}
 	**/
 	function testTooMuchImportAll() {
-		// eq("String", type(pos(1)));
+		eq("String", type(pos(1)));
 	}
 
 	/**

+ 1 - 1
tests/display/src/cases/Issue9319.hx

@@ -9,6 +9,6 @@ class Issue9319 extends DisplayTestCase {
 		}
 	**/
 	function testCatch_noTypeHint() {
-		// eq("haxe.Exception", type(pos(1)));
+		eq("haxe.Exception", type(pos(1)));
 	}
 }

+ 6 - 6
tests/display/src/cases/Issue9401.hx

@@ -30,11 +30,11 @@ class Issue9401 extends DisplayTestCase {
 		}
 	**/
 	function testCatch_noTypeHint() {
-		// eq("a0", doc(pos(1)));
-		// eq("a0", doc(pos(2)));
-		// eq("a0", doc(pos(3)));
-		// eq("a0", doc(pos(4)));
-		// eq("b0", doc(pos(5)));
-		// eq("b0", doc(pos(6)));
+		eq("a0", doc(pos(1)));
+		eq("a0", doc(pos(2)));
+		eq("a0", doc(pos(3)));
+		eq("a0", doc(pos(4)));
+		eq("b0", doc(pos(5)));
+		eq("b0", doc(pos(6)));
 	}
 }

+ 2 - 2
tests/display/src/cases/Issue9435.hx

@@ -12,7 +12,7 @@ class Issue9435 extends DisplayTestCase {
 		}
 	**/
 	function testCatch_noTypeHint() {
-		// var fields = toplevel(pos(1));
-		// eq(true, hasToplevel(fields, "local", "i"));
+		var fields = toplevel(pos(1));
+		eq(true, hasToplevel(fields, "local", "i"));
 	}
 }

+ 3 - 3
tests/display/src/cases/Issue9554.hx

@@ -19,8 +19,8 @@ class Issue9554 extends DisplayTestCase {
 
 	**/
 	function testCatch_noTypeHint() {
-		// var fields = fields(pos(1));
-		// eq(1, fields.length);
-		// eq(true, hasField(fields, "foo", "Int", "var"));
+		var fields = fields(pos(1));
+		eq(1, fields.length);
+		eq(true, hasField(fields, "foo", "Int", "var"));
 	}
 }

+ 1 - 1
tests/display/src/cases/Issue9824.hx

@@ -15,6 +15,6 @@ class Issue9824 extends DisplayTestCase {
 		}
 	**/
 	function test() {
-		// eq("String", type(pos(1)));
+		eq("String", type(pos(1)));
 	}
 }

+ 4 - 4
tests/display/src/cases/Issue9841.hx

@@ -19,9 +19,9 @@ class Issue9841 extends DisplayTestCase {
 		}
 	**/
 	function test() {
-		// var fields = fields(pos(1));
-		// eq(true, hasField(fields, "x", "Null<Float>", "var"));
-		// eq(true, hasField(fields, "y", "Null<Float>", "var"));
-		// eq(true, hasField(fields, "scale", "Null<Float>", "var"));
+		var fields = fields(pos(1));
+		eq(true, hasField(fields, "x", "Null<Float>", "var"));
+		eq(true, hasField(fields, "y", "Null<Float>", "var"));
+		eq(true, hasField(fields, "scale", "Null<Float>", "var"));
 	}
 }

+ 1 - 2
tests/display/src/cases/Issue9843.hx

@@ -11,7 +11,6 @@ class Issue9843 extends DisplayTestCase {
 		}
 	**/
 	function test() {
-		arrayEq([], []);
-		// arrayEq([], diagnostics());
+		arrayEq([], diagnostics());
 	}
 }

+ 19 - 19
tests/display/src/cases/Metadata.hx

@@ -141,53 +141,53 @@ class Metadata extends DisplayTestCase {
 		class Test {}
 
 	**/
-	// function test7864() {
-	// 	eq(true, hasPath(fields(pos(1)), "@:generic"));
-	// 	eq(true, hasPath(fields(pos(2)), "@:generic"));
-	// }
+	function test7864() {
+		eq(true, hasPath(fields(pos(1)), "@:generic"));
+		eq(true, hasPath(fields(pos(2)), "@:generic"));
+	}
 
 	/**
 		function main() {
 			var @{-1-}
 		}
 	**/
-	// function test9639_1() {
-	// 	eq(true, hasPath(fields(pos(1)), "@:generic"));
-	// }
+	function test9639_1() {
+		eq(true, hasPath(fields(pos(1)), "@:generic"));
+	}
 
 	/**
 		function main() {
 			var @{-1-} local
 		}
 	**/
-	// function test9639_2() {
-	// 	eq(true, hasPath(fields(pos(1)), "@:generic"));
-	// }
+	function test9639_2() {
+		eq(true, hasPath(fields(pos(1)), "@:generic"));
+	}
 
 	/**
 		function main() {
 			var @{-1-} local : Type
 		}
 	**/
-	// function test9639_3() {
-	// 	eq(true, hasPath(fields(pos(1)), "@:generic"));
-	// }
+	function test9639_3() {
+		eq(true, hasPath(fields(pos(1)), "@:generic"));
+	}
 
 	/**
 		function main() {
 			var @{-1-} local =
 		}
 	**/
-	// function test9639_4() {
-	// 	eq(true, hasPath(fields(pos(1)), "@:generic"));
-	// }
+	function test9639_4() {
+		eq(true, hasPath(fields(pos(1)), "@:generic"));
+	}
 
 	/**
 		function main() {
 			var @{-1-} local = 10
 		}
 	**/
-	// function test9639_5() {
-	// 	eq(true, hasPath(fields(pos(1)), "@:generic"));
-	// }
+	function test9639_5() {
+		eq(true, hasPath(fields(pos(1)), "@:generic"));
+	}
 }

+ 2 - 14
tests/server/src/TestCase.hx

@@ -95,7 +95,6 @@ class TestCase implements ITest {
 	}
 
 	function runHaxe(args:Array<String>, done:() -> Void) {
-		// trace(Sys.getCwd(), args);
 		messages = [];
 		errorMessages = [];
 		server.rawRequest(args, null, function(result) {
@@ -104,11 +103,7 @@ class TestCase implements ITest {
 				sendErrorMessage(result.stderr);
 			}
 			done();
-		}, function(err) {
-			trace(err);
-			debugMessages();
-			sendErrorMessage(err);
-		});
+		}, sendErrorMessage);
 	}
 
 	function runHaxeJson<TParams, TResponse>(args:Array<String>, method:HaxeRequestMethod<TParams, TResponse>, methodArgs:TParams, done:() -> Void) {
@@ -125,14 +120,7 @@ class TestCase implements ITest {
 		errorMessages = [];
 		server.rawRequest(args, null, function(result) {
 			handleResult(result);
-			// callback(Json.parse(result.stderr).result.result);
-			try callback(Json.parse(result.stderr).result.result)
-			catch (e) {
-					trace(result.stderr);
-					trace(e);
-					trace(args);
-					debugMessages();
-			}
+			callback(Json.parse(result.stderr).result.result);
 			done();
 		}, function(msg) {
 			sendErrorMessage(msg);

+ 0 - 0
tests/server/src/cases/RetyperTests.hx_ → tests/server/src/cases/RetyperTests.hx


+ 46 - 49
tests/server/src/cases/ServerTests.hx

@@ -65,13 +65,13 @@ class ServerTests extends TestCase {
 		assertHasPrint("2");
 	}
 
-	// function testDceEmpty() {
-	// 	vfs.putContent("Empty.hx", getTemplate("Empty.hx"));
-	// 	var args = ["-main", "Empty", "--no-output", "-java", "java"];
-	// 	runHaxe(args);
-	// 	runHaxeJson(args, cast "typer/compiledTypes" /* TODO */, {});
-	// 	assertHasField("", "Type", "enumIndex", true);
-	// }
+	function testDceEmpty() {
+		vfs.putContent("Empty.hx", getTemplate("Empty.hx"));
+		var args = ["-main", "Empty", "--no-output", "-java", "java"];
+		runHaxe(args);
+		runHaxeJson(args, cast "typer/compiledTypes" /* TODO */, {});
+		assertHasField("", "Type", "enumIndex", true);
+	}
 
 	function testBuildMacro() {
 		vfs.putContent("BuildMacro.hx", getTemplate("BuildMacro.hx"));
@@ -154,7 +154,6 @@ class ServerTests extends TestCase {
 			{file: new FsPath("Other.hx")},
 			{file: new FsPath("Main.hx")},
 		]}, res -> {
-			// trace(haxe.Json.stringify(res, "  "));
 			Assert.equals(1, res.length);
 			Assert.equals(1, res[0].diagnostics.length);
 			var arg = res[0].diagnostics[0].args;
@@ -220,46 +219,45 @@ class ServerTests extends TestCase {
 		});
 	}
 
-	// function testDiagnosticsRecache() {
-	// 	vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
-	// 	var args = ["--main", "HelloWorld", "--interp"];
-	// 	runHaxe(args);
-	// 	assertSuccess();
-	// 	runHaxe(args);
-	// 	assertReuse("HelloWorld");
-	// 	runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
-	// 	runHaxe(args);
-	// 	assertSkipping("HelloWorld", Tainted("server/invalidate"));
-	// 	runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
-	// 		Assert.equals(0, res.length);
-	// 	});
-	// 	runHaxe(args);
-	// 	assertReuse("HelloWorld");
-	// }
-
-	// function testDiagnosticsRecache2() {
-	// 	vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
-	// 	var args = ["--main", "HelloWorld", "--interp"];
-	// 	runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
-	// 		Assert.equals(0, res.length);
-	// 	});
-	// 	runHaxe(args);
-	// 	assertReuse("HelloWorld");
-	// }
-
-	// function testDiagnosticsRecache3() {
-	// 	vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
-	// 	var args = ["--main", "HelloWorld", "--interp"];
-	// 	runHaxe(args);
-	// 	runHaxe(args);
-	// 	assertReuse("HelloWorld");
-	// 	runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
-	// 	runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
-	// 		Assert.equals(0, res.length);
-	// 	});
-	// 	runHaxe(args.concat(["--display", "HelloWorld.hx@0@hover"]));
-	// 	assertReuse("HelloWorld");
-	// }
+	function testDiagnosticsRecache() {
+		vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
+		var args = ["--main", "HelloWorld", "--interp"];
+		runHaxe(args);
+		runHaxe(args);
+		assertReuse("HelloWorld");
+		runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
+		runHaxe(args);
+		assertSkipping("HelloWorld", Tainted("server/invalidate"));
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
+			Assert.equals(0, res.length);
+		});
+		runHaxe(args);
+		assertReuse("HelloWorld");
+	}
+
+	function testDiagnosticsRecache2() {
+		vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
+		var args = ["--main", "HelloWorld", "--interp"];
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
+			Assert.equals(0, res.length);
+		});
+		runHaxe(args);
+		assertReuse("HelloWorld");
+	}
+
+	function testDiagnosticsRecache3() {
+		vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
+		var args = ["--main", "HelloWorld", "--interp"];
+		runHaxe(args);
+		runHaxe(args);
+		assertReuse("HelloWorld");
+		runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
+			Assert.equals(0, res.length);
+		});
+		runHaxe(args.concat(["--display", "HelloWorld.hx@0@hover"]));
+		assertReuse("HelloWorld");
+	}
 
 	function testSyntaxCache() {
 		vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
@@ -430,7 +428,6 @@ class ServerTests extends TestCase {
 		var args = ["-main", "Main", "--jvm", "Main.jar"];
 		runHaxe(args);
 		vfs.touchFile("haxe/ds/Vector.hx");
-		// Missed async call
 		runHaxe(args);
 		assertSuccess();
 	}

+ 15 - 15
tests/server/src/cases/issues/Issue11177.hx

@@ -1,21 +1,21 @@
 package cases.issues;
 
 class Issue11177 extends TestCase {
-	// function test(_) {
-	// 	vfs.putContent("Main.hx", getTemplate("issues/Issue11177/Main.hx"));
-	// 	vfs.putContent("Buttons.hx", getTemplate("issues/Issue11177/Buttons.hx"));
-	// 	vfs.putContent("KeyCode.hx", getTemplate("issues/Issue11177/KeyCode.hx"));
-	// 	var args = ["-main", "Main", "--interp"];
-	// 	runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Buttons.hx")}, res -> {
-	// 		Assert.equals(0, res.length);
-	// 	});
-	// 	vfs.putContent("Main.hx", getTemplate("issues/Issue11177/Main2.hx"));
-	// 	runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
-	// 	runHaxe(args);
-	// 	runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Buttons.hx")}, res -> {
-	// 		Assert.equals(0, res.length);
-	// 	});
-	// }
+	function test(_) {
+		vfs.putContent("Main.hx", getTemplate("issues/Issue11177/Main.hx"));
+		vfs.putContent("Buttons.hx", getTemplate("issues/Issue11177/Buttons.hx"));
+		vfs.putContent("KeyCode.hx", getTemplate("issues/Issue11177/KeyCode.hx"));
+		var args = ["-main", "Main", "--interp"];
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Buttons.hx")}, res -> {
+			Assert.equals(0, res.length);
+		});
+		vfs.putContent("Main.hx", getTemplate("issues/Issue11177/Main2.hx"));
+		runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
+		runHaxe(args);
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Buttons.hx")}, res -> {
+			Assert.equals(0, res.length);
+		});
+	}
 
 	function testWithoutCacheFromDisplay(_) {
 		vfs.putContent("Main.hx", getTemplate("issues/Issue11177/Main.hx"));

+ 1 - 1
tests/server/test/templates/issues/Issue9358/StateHandler.hx

@@ -1,4 +1,4 @@
-// @:generic
+@:generic
 class StateHandler<S> {
 	public var state(default, set):S;