Am 16.08.2022 um 13:19 schrieb Michael Van Canneyt via fpc-devel:
On Tue, 16 Aug 2022, Ondrej Pokorny via fpc-devel wrote:
--- code end

Run it in Delphi and FPC and compare the outputs:

Delphi output:
PropCount: 0
Property info is null

FPC output:
PropCount: 1
Property name: Fruit
Property kind: tkEnumeration

As you can see FPC creates a valid PropInfo for the property with valid TypeInfo (PI^.PropType) of the kind tkEnumeration! This is definitely wrong.

So the solution is either:

1.) don't create PropInfo for the Fruit property like Delphi.
- or -
2.) PropType must not be thEnumeration. It should be either tkInteger or a new custom value like tkCEnumeration or whatever. Because thEnumeration means it has the enumeration TypeInfo with GetEnumName and GetEnumValue.

tkInteger or no propinfo at all seems the only correct solution to me, with
slight preference for no propinfo at all.
Sorry I forgot - a third solution that you and Martin suggested before is also OK: 3.) compile error when the Fruit property is published (it is allowed only in the private..public sections).

So, I suggest:

*) Delphi mode:  ignore the PropInfo (Delphi compatibility)
*) ObjFpc mode: compiler error (because you prefer no propinfo at all and ObjFpc is usually more strict than Delphi).

I've done some PropInfo work before, I assume I could prepare a patch for it. Can I start with this work?

Ondrej

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to