still wrong O801 in Beta 2026

Hello,

this problem is not new but still a problem.

When using a property with an index e.g.

Property UserLastKey[AName: String]: String Read GetUserLastKey
  Write SetUserLastKey;

O801 is shown on the setter and getter procedure.

Function TDMBRConfig.GetUserLastKey(AName: String): String; // FI:O801

I think it’s a valid warning but Delphi doesnt like the modification of the signature of these kind of procedures.

Björn

Hello,

Iäve used const successfully in such a cases.

In what way Delphi does not like that, and/or which Delphi version.

Tommi Prami

I’m getting a compiler error:

[dcc64 Fehler] BRDMConfig.pas(530): E2008 Inkompatible Typen (incampatible types)

in the line with the property definition.

type
  TTestClass = class(TObject)
  strict private
    FStringList: TStringList;
  private
    function GetNames(const AName: string): string;
    procedure SetNames(const AName, AValue: string);
  public
    constructor Create;
    destructor Destroy; override;

    property Names[const AName: string]: string read GetNames write SetNames;
  end;

...

{ TTestClass }

constructor TTestClass.Create;
begin
  inherited Create;

  FStringList := TStringList.Create;
end;

destructor TTestClass.Destroy;
begin
  FStringList.Free;

  inherited Destroy;
end;

function TTestClass.GetNames(const AName: string): string;
begin
  Result := FStringList.Names[FStringList.IndexOfName(AName)];
end;

procedure TTestClass.SetNames(const AName, AValue: string);
begin
  FStringList.AddPair(AName, AValue);
end;

-Tommi Prami-