View Issue Details

IDProjectCategoryView StatusLast Update
0037634FPCCompilerpublic2020-09-12 15:06
ReporterGrahame Grieve Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.2.0 
Summary0037634: An error message with no location or details for a property named 'system' with abstract property accessors
DescriptionA 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:

program Project1;
 
//{$mode Delphi}
{$mode objfpc}
 
uses
  Classes;
 
type
  TSystemClass = class
  private
    x: string;
    function GetX: String; virtual; abstract;
    procedure SetX(value: String); virtual; abstract;
  public
    property System: String read GetX write SetX;
  end;
 
begin
end.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Jonas Maebe

2020-08-23 23:53

manager   ~0125096

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.

jamie philbrook

2020-08-24 01:20

reporter   ~0125098

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

 .System.TheMemberName;
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..

Grahame Grieve

2020-09-12 05:46

reporter   ~0125498

Well, the primary bug is that you get no information about the error. I don't mind it actually being an error

Thaddy de Koning

2020-09-12 15:00

reporter   ~0125506

Last edited: 2020-09-12 15:02

View 2 revisions

"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.

Jonas Maebe

2020-09-12 15:06

manager   ~0125510

No, it needs to be fixed.

Issue History

Date Modified Username Field Change
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