Browse Source

don't catch `Module_not_found` so much (closes #5644)

Simon Krajewski 8 năm trước cách đây
mục cha
commit
c2722081ad

+ 1 - 1
src/typing/typeload.ml

@@ -1482,7 +1482,7 @@ module Inheritance = struct
 			try
 			try
 				let t = load_instance ~allow_display:true ctx t false p in
 				let t = load_instance ~allow_display:true ctx t false p in
 				Some (check_herit t is_extends)
 				Some (check_herit t is_extends)
-			with Error(Module_not_found(([],name)),p) ->
+			with Error(Module_not_found(([],name)),p) when ctx.com.display.dms_display ->
 				if Display.Diagnostics.is_diagnostics_run ctx then Display.ToplevelCollector.handle_unresolved_identifier ctx name p true;
 				if Display.Diagnostics.is_diagnostics_run ctx then Display.ToplevelCollector.handle_unresolved_identifier ctx name p true;
 				None
 				None
 		) herits in
 		) herits in

+ 1 - 1
src/typing/typer.ml

@@ -583,7 +583,7 @@ let rec unify_call_args' ctx el args r callp inline force_inline =
 		try
 		try
 			let e = type_expr ctx e (WithType t) in
 			let e = type_expr ctx e (WithType t) in
 			AbstractCast.cast_or_unify_raise ctx t e e.epos
 			AbstractCast.cast_or_unify_raise ctx t e e.epos
-		with Error(l,p) when (match l with Call_error _ -> false | _ -> true) ->
+		with Error(l,p) when (match l with Call_error _ | Module_not_found _ -> false | _ -> true) ->
 			raise (WithTypeError (l,p))
 			raise (WithTypeError (l,p))
 	in
 	in
 	let rec loop el args = match el,args with
 	let rec loop el args = match el,args with

+ 9 - 0
tests/misc/projects/Issue5644/Main.hx

@@ -0,0 +1,9 @@
+class Main {
+  static function main() {
+    return Gen.gen(Main, User);
+  }
+}
+
+extern class Gen {
+    public static function gen(type:Dynamic, ?attrs:Dynamic, children:haxe.extern.Rest<Dynamic>):Void;
+}

+ 1 - 0
tests/misc/projects/Issue5644/User.hx

@@ -0,0 +1 @@
+class User extends ThisObviouslyDoesntExist<T> {}

+ 3 - 0
tests/misc/projects/Issue5644/compile-fail.hxml

@@ -0,0 +1,3 @@
+-main Main
+--no-output
+-js js.js

+ 2 - 0
tests/misc/projects/Issue5644/compile-fail.hxml.stderr

@@ -0,0 +1,2 @@
+User.hx:1: characters 19-46 : Type not found : ThisObviouslyDoesntExist
+Main.hx:1: lines 1-5 : Defined in this class