diff --git a/Neslib.Collections.pas b/Neslib.Collections.pas index a00a858..54594df 100644 --- a/Neslib.Collections.pas +++ b/Neslib.Collections.pas @@ -3455,8 +3455,6 @@ function TDictionary.ContainsKey(const AKey: TKey): Boolean; Index := (Index + 1) and Mask; end; - - Result := False; end; function TDictionary.ContainsValue(const AValue: TValue): Boolean; @@ -3541,6 +3539,8 @@ function TDictionary.GetItem(const AKey: TKey): TValue; var Mask, Index, HashCode, HC: Integer; begin + Result := Default(TValue); + if (FCount = 0) then _GenericItemNotFoundError; @@ -4042,7 +4042,7 @@ function TConcurrentDictionary.Remove(const AKey: TKey): Boolean; begin FLock.Acquire; try - FDictionary.Remove(AKey); + Result := FDictionary.Remove(AKey); finally FLock.Release; end; @@ -4160,8 +4160,6 @@ function TSet.Contains(const AItem: T): Boolean; Index := (Index + 1) and Mask; end; - - Result := False; end; constructor TSet.Create(const AComparer: IEqualityComparer); diff --git a/UnitTests/Tests/Tests.Collections.Base.pas b/UnitTests/Tests/Tests.Collections.Base.pas index fa47556..1df291f 100644 --- a/UnitTests/Tests/Tests.Collections.Base.pas +++ b/UnitTests/Tests/Tests.Collections.Base.pas @@ -447,13 +447,13 @@ procedure TTestCollectionBase.ReleaseValue(const AValue: T); begin case FTypeInfo.Kind of tkClass: - Obj.DisposeOf; + Obj.Free; tkRecord: if (FTypeInfo.NameFld.ToString = 'TFooBarRecord') then begin - FB.Foo.DisposeOf; - FB.Bar.DisposeOf; + FB.Foo.Free; + FB.Bar.Free; end; tkDynArray: