Browse Source

compiler: improve comparison for property and getter. it was possible to declare a class property with regular method for the getter because of cpo_ignorehidden flag

git-svn-id: trunk@14650 -
paul 15 years ago
parent
commit
e9214c1826
1 changed files with 3 additions and 1 deletions
  1. 3 1
      compiler/pdecvar.pas

+ 3 - 1
compiler/pdecvar.pas

@@ -449,7 +449,9 @@ implementation
                             non default calling conventions which might change the hidden stuff;
                             non default calling conventions which might change the hidden stuff;
                             see tw3216.pp (FK) }
                             see tw3216.pp (FK) }
                           p.propaccesslist[palt_read].procdef:=Tprocsym(sym).Find_procdef_bypara(readprocdef.paras,p.propdef,[cpo_allowdefaults,cpo_ignorehidden]);
                           p.propaccesslist[palt_read].procdef:=Tprocsym(sym).Find_procdef_bypara(readprocdef.paras,p.propdef,[cpo_allowdefaults,cpo_ignorehidden]);
-                          if not assigned(p.propaccesslist[palt_read].procdef) then
+                          if not assigned(p.propaccesslist[palt_read].procdef) or
+                            { because of cpo_ignorehidden we need to compare if it is a static class method and we have a class property }
+                            ((sp_static in p.symoptions) <> ([po_classmethod,po_staticmethod]<=tprocdef(p.propaccesslist[palt_read].procdef).procoptions)) then
                             Message(parser_e_ill_property_access_sym);
                             Message(parser_e_ill_property_access_sym);
                         end;
                         end;
                       fieldvarsym :
                       fieldvarsym :