From 9513b50d26bcadd0c55365d547f38cb4e388b287 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 14 Jan 2010 15:21:13 +0000 Subject: [PATCH] compiler: don't allow to publish class properties + test git-svn-id: trunk@14640 - --- .gitattributes | 1 + compiler/pdecvar.pas | 2 +- tests/test/tclass14b.pp | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/test/tclass14b.pp diff --git a/.gitattributes b/.gitattributes index da96c5bb26..0ceca85f1f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 725bcacad9..f733f0f7aa 100644 --- a/compiler/pdecvar.pas +++ b/compiler/pdecvar.pas @@ -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; diff --git a/tests/test/tclass14b.pp b/tests/test/tclass14b.pp new file mode 100644 index 0000000000..8869e4b034 --- /dev/null +++ b/tests/test/tclass14b.pp @@ -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.