Răsfoiți Sursa

[display] Do not silently replace missing types with Dynamic (#11760)

* [typer] don't ignore Context.resolveType errors in display

* [tests] fix tests
Rudy Ges 1 an în urmă
părinte
comite
99e8bb4338

+ 1 - 3
src/typing/typeload.ml

@@ -644,9 +644,7 @@ and load_complex_type ctx allow_display mode (t,pn) =
 		if Diagnostics.error_in_diagnostics_run ctx.com err.err_pos then begin
 		if Diagnostics.error_in_diagnostics_run ctx.com err.err_pos then begin
 			delay ctx.g PForce (fun () -> DisplayToplevel.handle_unresolved_identifier ctx name err.err_pos true);
 			delay ctx.g PForce (fun () -> DisplayToplevel.handle_unresolved_identifier ctx name err.err_pos true);
 			t_dynamic
 			t_dynamic
-		end else if ignore_error ctx.com && not (DisplayPosition.display_position#enclosed_in pn) then
-			t_dynamic
-		else
+		end else
 			raise (Error err)
 			raise (Error err)
 
 
 and init_meta_overloads ctx co cf =
 and init_meta_overloads ctx co cf =

+ 1 - 0
tests/display/src/cases/InMacro.hx

@@ -4,6 +4,7 @@ class InMacro extends DisplayTestCase {
 	/**
 	/**
 
 
 		import haxe.macro.Context;
 		import haxe.macro.Context;
+		import haxe.macro.Expr;
 
 
 		class Main {
 		class Main {
 
 

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

@@ -5,7 +5,7 @@ class Issue6399 extends DisplayTestCase {
 		class Main {
 		class Main {
 			public static function main() {}
 			public static function main() {}
 
 
-			macro function foo({-1-}name{-2-}:String, {-3-}struct{-4-}:Expr, {-5-}defaults{-6-}:Expr) {
+			macro function foo({-1-}name{-2-}:String, {-3-}struct{-4-}:haxe.macro.Expr, {-5-}defaults{-6-}:haxe.macro.Expr) {
 				return macro {
 				return macro {
 					if ($str{-7-}uct.$n{-8-}ame == null) $str{-9-}uct.$n{-10-}ame = $defa{-11-}ults.$n{-12-}ame;
 					if ($str{-7-}uct.$n{-8-}ame == null) $str{-9-}uct.$n{-10-}ame = $defa{-11-}ults.$n{-12-}ame;
 				}
 				}
@@ -20,10 +20,10 @@ class Issue6399 extends DisplayTestCase {
 
 
 		for (i in [7, 9]) {
 		for (i in [7, 9]) {
 			eq(range(3, 4), position(pos(i)));
 			eq(range(3, 4), position(pos(i)));
-			eq("Dynamic", type(pos(i)));
+			eq("haxe.macro.Expr", type(pos(i)));
 		}
 		}
 
 
 		eq(range(5, 6), position(pos(11)));
 		eq(range(5, 6), position(pos(11)));
-		eq("Dynamic", type(pos(11)));
+		eq("haxe.macro.Expr", type(pos(11)));
 	}
 	}
 }
 }

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

@@ -5,13 +5,13 @@ class Issue6417 extends DisplayTestCase {
 		class Main {
 		class Main {
 			static function main() {}
 			static function main() {}
 
 
-			macro function foo({-1-}body{-2-}:Expr) {
+			macro function foo({-1-}body{-2-}:haxe.macro.Expr) {
 				macro function() $bo{-3-}dy;
 				macro function() $bo{-3-}dy;
 			}
 			}
 		}
 		}
 	**/
 	**/
 	function test() {
 	function test() {
 		eq(range(1, 2), position(pos(3)));
 		eq(range(1, 2), position(pos(3)));
-		eq("Dynamic", type(pos(3)));
+		eq("haxe.macro.Expr", type(pos(3)));
 	}
 	}
 }
 }