|
@@ -180,10 +180,16 @@ let check_overriding ctx c f =
|
|
|
(match f2.cf_kind with
|
|
|
| Var { v_read = AccRequire _ } -> raise Not_found;
|
|
|
| _ -> ());
|
|
|
+ if has_class_field_flag f2 CfAbstract then begin
|
|
|
+ if has_class_field_flag f CfOverride
|
|
|
+ then display_error ctx ("Field " ^ i ^ " is declared 'override' but parent field " ^ i ^ " is 'abstract' and does not provide any implementation to override") p
|
|
|
+ else
|
|
|
+ add_class_field_flag f CfOverride (* our spec requires users to not "override" abstract functions, but our implementation depends on implementations to be declared with "override" ¯\_(ツ)_/¯ *)
|
|
|
+ end;
|
|
|
if (has_class_field_flag f2 CfOverload && not (has_class_field_flag f CfOverload)) then
|
|
|
display_error ctx ("Field " ^ i ^ " should be declared with overload since it was already declared as overload in superclass") p
|
|
|
else if not (has_class_field_flag f CfOverride) then begin
|
|
|
- if has_class_flag c CExtern || has_class_field_flag f2 CfAbstract then add_class_field_flag f CfOverride
|
|
|
+ if has_class_flag c CExtern then add_class_field_flag f CfOverride
|
|
|
else display_error ctx ("Field " ^ i ^ " should be declared with 'override' since it is inherited from superclass " ^ s_type_path csup.cl_path) p
|
|
|
end else if not (has_class_field_flag f CfPublic) && (has_class_field_flag f2 CfPublic) then
|
|
|
display_error ctx ("Field " ^ i ^ " has less visibility (public/private) than superclass one") p
|