compiler: don't allow to publish class properties + test

git-svn-id: trunk@14640 -
This commit is contained in:
paul 2010-01-14 15:21:13 +00:00
parent 09fd52791a
commit 9513b50d26
3 changed files with 21 additions and 1 deletions

1
.gitattributes vendored
View File

@ -8900,6 +8900,7 @@ tests/test/tclass12b.pp svneol=native#text/pascal
tests/test/tclass12c.pp svneol=native#text/pascal
tests/test/tclass13.pp svneol=native#text/pascal
tests/test/tclass14a.pp svneol=native#text/pascal
tests/test/tclass14b.pp svneol=native#text/pascal
tests/test/tclass2.pp svneol=native#text/plain
tests/test/tclass3.pp svneol=native#text/plain
tests/test/tclass4.pp svneol=native#text/plain

View File

@ -423,7 +423,7 @@ implementation
end;
end;
if ((p.visibility=vis_published) or is_dispinterface(aclass)) and
not(p.propdef.is_publishable) then
(not(p.propdef.is_publishable) or (sp_static in p.symoptions)) then
begin
Message(parser_e_cant_publish_that_property);
p.visibility:=vis_public;

19
tests/test/tclass14b.pp Normal file
View File

@ -0,0 +1,19 @@
{ %FAIL}
program tclass14b;
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
type
TSomeClass = class
public
class var
FSomeField: Integer;
published
// class properties are not for sreaming therefore publishing them is not supported
class property SomeField: Integer read FSomeField write FSomeField;
end;
begin
end.