Jens Geyer created THRIFT-6303:
----------------------------------

             Summary: Thrift.Collections: Delphi 2010 code path of 
TThriftDictionaryImpl.ToArray references the renamed field FDictionaly
                 Key: THRIFT-6303
                 URL: https://issues.apache.org/jira/browse/THRIFT-6303
             Project: Thrift
          Issue Type: Bug
          Components: Delphi - Library
    Affects Versions: 0.22.0, 0.19.0, 0.20.0, 0.24.0, 0.23.0, 0.21.0
            Reporter: Jens Geyer
             Fix For: 0.26.0


{{TThriftDictionaryImpl<TKey,TValue>.ToArray}} in 
{{lib/delphi/src/Thrift.Collections.pas}} has a separate code path for Delphi 
2010 ({{CompilerVersion < 22.0}}):

{noformat}
function TThriftDictionaryImpl<TKey, TValue>.ToArray: TArray<TPair<TKey, 
TValue>>;
{$IF CompilerVersion < 22.0}
var
  x : TPair<TKey, TValue>;
  i : Integer;
{$IFEND}
begin
{$IF CompilerVersion < 22.0}
  SetLength(Result, Count);
  i := 0;
  for x in FDictionaly do   // <-- line 415
  begin
    Result[i] := x;
    Inc( i );
  end;
{$ELSE}
  Result := FDictionary.ToArray;
{$IFEND}
end;
{noformat}

THRIFT-5686 (commit f5627536b, first released in 0.19.0) renamed the field 
{{FDictionaly}} to {{FDictionary}} but did not update this branch. 
{{FDictionaly}} is no longer declared anywhere, so with Delphi 2010, the 
minimum version documented in {{lib/delphi/README.md}}, {{Thrift.Collections}} 
cannot compile. All later Delphi versions take the other branch and are not 
affected.

Fix: use {{FDictionary}} in the Delphi 2010 branch as well.

Found while compiling the library with Free Pascal and the Delphi 2010 branches 
enabled. Not verified with an actual Delphi 2010 installation.

_Drafted with AI assistance (Claude Opus 5); posted on behalf of Jens Geyer._




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to