Browse Source

improved a bit some error messages.

Nicolas Cannasse 19 years ago
parent
commit
14f6fdea8e
1 changed files with 3 additions and 2 deletions
  1. 3 2
      typer.ml

+ 3 - 2
typer.ml

@@ -1454,7 +1454,7 @@ let check_overloading c p () =
 			try
 				let f2 = PMap.find f.cf_name c.cl_fields in
 				if not (type_eq false (field_type f) (field_type f2)) then error ("Field " ^ f.cf_name ^ " overload parent class with different or incomplete type") p;
-				if f.cf_public <> f2.cf_public then error ("Field " ^ f.cf_name ^ " has different access right than previous one") p;
+				if f.cf_public <> f2.cf_public then error ("Field " ^ f.cf_name ^ " has different visibility (public/private) than previous one") p;
 			with
 				Not_found -> loop c.cl_super f
 	in
@@ -1465,7 +1465,8 @@ let check_interfaces c p () =
 		PMap.iter (fun i f ->
 			try
 				let t , f2 = class_field c i in
-				if f2.cf_public <> f.cf_public || f2.cf_get <> f.cf_get || f2.cf_set <> f.cf_set then error ("Field " ^ i ^ " has different access than in " ^ s_type_path intf.cl_path) p;
+				if f2.cf_public <> f.cf_public then error ("Field " ^ i ^ " has different visibility (public/private) than in " ^ s_type_path intf.cl_path) p;
+				if f2.cf_get <> f.cf_get || f2.cf_set <> f.cf_set then error ("Field " ^ i ^ " has different property access than in " ^ s_type_path intf.cl_path) p;
 				if not (type_eq false (field_type f2) (apply_params intf.cl_types params (field_type f))) then error ("Field " ^ i ^ " has different type than in " ^ s_type_path intf.cl_path) p;
 			with
 				Not_found ->