Browse Source

output positions of base/interface fields in case of invalid redefinition (see #4793)

Simon Krajewski 9 years ago
parent
commit
b9ccf198d6

+ 1 - 0
tests/misc/projects/Issue3361/compile1-fail.hxml.stderr

@@ -1,3 +1,4 @@
 Main.hx:5: lines 5-8 : Field v has different type than in I
+Main.hx:2: characters 8-28 : Interface field is defined here
 Main.hx:5: lines 5-8 : String -> Void should be Dynamic -> Void
 Main.hx:5: lines 5-8 : String should be Dynamic

+ 1 - 0
tests/misc/projects/Issue3361/compile2-fail.hxml.stderr

@@ -1,3 +1,4 @@
 Main2.hx:6: characters 16-45 : Field f has different type than in I
+Main2.hx:2: characters 16-43 : Interface field is defined here
 Main2.hx:6: characters 16-45 : s : String -> Void should be d : Dynamic -> Void
 Main2.hx:6: characters 16-45 : String should be Dynamic

+ 2 - 1
tests/misc/projects/Issue3417/compile-fail.hxml.stderr

@@ -1,2 +1,3 @@
 Main.hx:6: characters 11-26 : Field f has different type than in I
-Main.hx:6: characters 11-26 : Different number of function arguments
+Main.hx:2: characters 4-27 : Interface field is defined here
+Main.hx:6: characters 11-26 : Different number of function arguments

+ 1 - 0
tests/misc/projects/Issue4378/compile-fail.hxml.stderr

@@ -1,3 +1,4 @@
 Main.hx:5: lines 5-7 : Field test has different type than in I
+Main.hx:16: characters 1-31 : Interface field is defined here
 Main.hx:5: lines 5-7 : s : String -> Void should be s : Dynamic -> Void
 Main.hx:5: lines 5-7 : String should be Dynamic

+ 2 - 0
typeload.ml

@@ -888,6 +888,7 @@ let check_overriding ctx c =
 				with
 					Unify_error l ->
 						display_error ctx ("Field " ^ i ^ " overloads parent class with different or incomplete type") p;
+						display_error ctx ("Base field is defined here") f2.cf_pos;
 						display_error ctx (error_msg (Unify l)) p;
 			with
 				Not_found ->
@@ -973,6 +974,7 @@ let rec check_interface ctx c intf params =
 				Unify_error l ->
 					if not (Meta.has Meta.CsNative c.cl_meta && c.cl_extern) then begin
 						display_error ctx ("Field " ^ i ^ " has different type than in " ^ s_type_path intf.cl_path) p;
+						display_error ctx ("Interface field is defined here") f.cf_pos;
 						display_error ctx (error_msg (Unify l)) p;
 					end
 		with