View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0037634||FPC||Compiler||public||2020-08-23 23:25||2020-09-12 15:06|
|Reporter||Grahame Grieve||Assigned To|
|Summary||0037634: An error message with no location or details for a property named 'system' with abstract property accessors|
|Description||A property named 'system' with abstract property accessors results in an error message with no location or details. This makes it really difficult to trace down to a source. The error message should at least name the property and/or indicate a location in source|
Note that a property named 'system' is valid in delphi, so that may also be an issue.
|Steps To Reproduce|
try compiling this:
TSystemClass = class
function GetX: String; virtual; abstract;
procedure SetX(value: String); virtual; abstract;
property System: String read GetX write SetX;
|Tags||No tags attached.|
|Fixed in Revision|
There is already a bug report about this, but I can't find it. It's because this construct (and a number of others) are handled by the compiler internally generating Pascal code and then feeding that back into the parser. In this code it tries to reference a symbol from the system unit and prefixes it with "system." to prevent any same-named symbols in the current scope from overriding them. Of course, that breaks down if there is a symbol called "system" in the current scope.
This definitely needs fixing, but unfortunately it's quite hard.
Bare in mind that fixing this will also make it hard to call a system function that may have a name tag within the local space already.
Which brings back a point I made long ago and got shot down of course..
Using a back scope operator like C/C++ does.. ::System.TheName , this would step out of the current scope and use a previous scope of the same name..
But this would need to be indicated as the number of times to step backwards..
of course something like this would get used only once in a blue moon but for the Pascal rendition I did suggest using the DOT signifier on the left.. One for each back step of scope
of course that maybe hard to the eyes so using a : could be better, one for each back step incase we are in nested code etc..
||Well, the primary bug is that you get no information about the error. I don't mind it actually being an error|
"Yes my son is called Drop Tables, dear Bobby"
Suggest to just document this. https://bobby-tables.com/
It is about the same as using system.
||No, it needs to be fixed.|
|2020-08-23 23:25||Grahame Grieve||New Issue|
|2020-08-23 23:53||Jonas Maebe||Note Added: 0125096|
|2020-08-24 01:20||jamie philbrook||Note Added: 0125098|
|2020-09-12 05:46||Grahame Grieve||Note Added: 0125498|
|2020-09-12 15:00||Thaddy de Koning||Note Added: 0125506|
|2020-09-12 15:02||Thaddy de Koning||Note Edited: 0125506||View Revisions|
|2020-09-12 15:06||Jonas Maebe||Note Added: 0125510|