|
@@ -1474,7 +1474,9 @@ let init_class ctx c p context_init herits fields =
|
|
|
if c.cl_constructor <> None then error "Duplicate constructor" p;
|
|
|
c.cl_constructor <- Some f;
|
|
|
end else if not is_static || f.cf_name <> "__init__" then begin
|
|
|
- if PMap.mem f.cf_name (if is_static then c.cl_statics else c.cl_fields) then error ("Duplicate class field declaration : " ^ f.cf_name) p;
|
|
|
+ if PMap.mem f.cf_name (if is_static then c.cl_statics else c.cl_fields) then
|
|
|
+ display_error ctx ("Duplicate class field declaration : " ^ f.cf_name) p
|
|
|
+ else
|
|
|
let dup = if is_static then PMap.exists f.cf_name c.cl_fields || has_field f.cf_name c.cl_super else PMap.exists f.cf_name c.cl_statics in
|
|
|
if dup then error ("Same field name can't be use for both static and instance : " ^ f.cf_name) p;
|
|
|
if is_static then begin
|