Compiler error when getting an entry from array property result
Summary
Chained array selections don't compile for properties: Items['key'][0];
Example Project
library Project1;
{$mode objfpc}
uses
JS, Classes, SysUtils;
type
TMyRec = record
K: string;
end;
TMyArray = array of TMyRec;
TMyObj = class
private
function GetItems(const Key: string): TMyArray;
public
property Items[const Key: string]: TMyArray read GetItems;
end;
{ TMyObj }
function TMyObj.GetItems(const Key: string): TMyArray;
var
R: TMyRec;
begin
R.K := Key;
Result := [R];
end;
var
O: TMyObj;
R: TMyRec;
begin
O := TMyObj.Create;
R := O.Items['key'][0]; // project1.lpr(36,22) Error: Incompatible types: got "TMyArray" expected "TMyRec"
end.