Hi, I'm experiencing some inconsistencies with TDictionary. If I run the below program I would expect all written values to be TRUE but I get 1 FALSE. The result is both in ObjFpc and Delphi modes with ShortString as the key.
program dictionary;
{$mode delphi}
uses Generics.Collections;
var
Map: TDictionary<ShortString, Integer>;
s: ShortString;
begin
Map := TDictionary<ShortString, Integer>.Create;
Map.Add('one', 1);
Map.Add('two', 2);
Map.Add('three', 3);
Map.Add('four', 4);
Map.Add('five', 5);
Map.Add('six', 6);
Map.Add('seven', 7);
Map.Add('eight', 8);
for s in Map.Keys do
writeln(s);
writeln('one: ', Map.ContainsKey('one'));
writeln('two: ', Map.ContainsKey('two'));
writeln('three: ', Map.ContainsKey('three')); // <-- returns FALSE
writeln('four: ', Map.ContainsKey('four'));
writeln('five: ', Map.ContainsKey('five'));
writeln('six: ', Map.ContainsKey('six'));
writeln('seven: ', Map.ContainsKey('seven'));
writeln('eight: ', Map.ContainsKey('eight'));
Map.Free;
end.
Can anyone confirm this? Or has an explanation for this behaviour ?
MacOS Ventura 13.2
Lazarus 2.3.0 (rev main-2_3-3328-g448bb20ba6) FPC 3.3.1 x86_64-darwin-cocoa