From 3853164adad2d8712646465f8f3e5713cac8b0e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:36:17 +0200 Subject: [PATCH 01/19] Bump Microsoft.VSSDK.BuildTools from 17.10.2179 to 17.11.435 (#156) Bumps Microsoft.VSSDK.BuildTools from 17.10.2179 to 17.11.435. --- updated-dependencies: - dependency-name: Microsoft.VSSDK.BuildTools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Akade.IndexedSet.Analyzers.Vsix.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj index cf61e6e..d6ba73c 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj @@ -19,7 +19,7 @@ - + From 249171f977a3117885bd28b7872b93dd29b33d8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:47:30 +0200 Subject: [PATCH 02/19] Bump dotnet-reportgenerator-globaltool from 5.3.6 to 5.3.9 (#158) Bumps [dotnet-reportgenerator-globaltool](https://github.com/danielpalme/ReportGenerator) from 5.3.6 to 5.3.9. - [Release notes](https://github.com/danielpalme/ReportGenerator/releases) - [Commits](https://github.com/danielpalme/ReportGenerator/compare/v5.3.6...v5.3.9) --- updated-dependencies: - dependency-name: dotnet-reportgenerator-globaltool dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 2c1bcff..b2833ad 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-reportgenerator-globaltool": { - "version": "5.3.6", + "version": "5.3.9", "commands": [ "reportgenerator" ] From 593d0b218b664f632ebc4241764da1a711215cd6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 18:01:04 +0200 Subject: [PATCH 03/19] Bump Fastenshtein from 1.0.0.9 to 1.0.10 (#159) Bumps [Fastenshtein](https://github.com/DanHarltey/Fastenshtein) from 1.0.0.9 to 1.0.10. - [Release notes](https://github.com/DanHarltey/Fastenshtein/releases) - [Commits](https://github.com/DanHarltey/Fastenshtein/compare/1.0.0.9...1.0.10) --- updated-dependencies: - dependency-name: Fastenshtein dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj index 801f5b3..02c5f8e 100644 --- a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj +++ b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj @@ -11,7 +11,7 @@ - + From f49ae2df20a72c5a374c35ecc903553ac2104119 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 18:37:53 +0200 Subject: [PATCH 04/19] Bump Verify.MSTest and MSTest.TestFramework (#150) Bumps [Verify.MSTest](https://github.com/VerifyTests/Verify) and [MSTest.TestFramework](https://github.com/microsoft/testfx). These dependencies needed to be updated together. Updates `Verify.MSTest` from 23.7.2 to 26.0.0 - [Release notes](https://github.com/VerifyTests/Verify/releases) - [Commits](https://github.com/VerifyTests/Verify/compare/23.7.2...26.0.0) Updates `MSTest.TestFramework` from 3.3.0 to 3.5.0 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.3.0...v3.5.0) --- updated-dependencies: - dependency-name: Verify.MSTest dependency-type: direct:production update-type: version-update:semver-major - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Akade.IndexedSet.InternalSourceGenerator.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index 29c11e5..0676d4c 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -10,13 +10,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 4e910368792c0a6ca52a46870cdbdf87db1b4eca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 12:28:23 +0200 Subject: [PATCH 05/19] Bump Bogus from 35.5.1 to 35.6.1 (#161) Bumps [Bogus](https://github.com/bchavez/Bogus) from 35.5.1 to 35.6.1. - [Release notes](https://github.com/bchavez/Bogus/releases) - [Changelog](https://github.com/bchavez/Bogus/blob/master/HISTORY.md) - [Commits](https://github.com/bchavez/Bogus/compare/v35.5.1...v35.6.1) --- updated-dependencies: - dependency-name: Bogus dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj | 2 +- Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj index 02c5f8e..cf70aee 100644 --- a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj +++ b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj @@ -10,7 +10,7 @@ - + diff --git a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj index 6c09dad..23b9181 100644 --- a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj +++ b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj @@ -8,7 +8,7 @@ - + From aa4217b08de4ad4a4c524ef4858c13645efb9bbd Mon Sep 17 00:00:00 2001 From: Alex <16369295+akade@users.noreply.github.com> Date: Thu, 3 Oct 2024 20:26:33 +0200 Subject: [PATCH 06/19] Updated all packages to their latest version (#163) --- .../Akade.IndexedSet.Benchmarks.csproj | 4 ++-- .../Akade.IndexedSet.Tests.csproj | 6 +++--- .../Akade.IndexedSet.Analyzers.Test.csproj | 20 +++++++++---------- .../Akade.IndexedSet.Analyzers.csproj | 4 ++-- ...edSet.InternalSourceGenerator.Tests.csproj | 12 +++++------ ....IndexedSet.InternalSourceGenerator.csproj | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj index cf70aee..0233bbf 100644 --- a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj +++ b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj @@ -1,4 +1,4 @@ - + Exe @@ -9,7 +9,7 @@ - + diff --git a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj index 23b9181..c02debd 100644 --- a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj +++ b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj @@ -9,9 +9,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj index 201ba2e..6d33aa9 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj @@ -8,16 +8,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj b/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj index 8d6dbbe..a60a125 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj @@ -11,8 +11,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index 0676d4c..a3d44a7 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -8,16 +8,16 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj index 676f2f9..6321fa0 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj @@ -11,8 +11,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive From d231fe84b4c7a8bc7bd73fae93cbe9a3a8398112 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:17:52 +0200 Subject: [PATCH 07/19] Bump dotnet-reportgenerator-globaltool from 5.3.9 to 5.3.10 (#164) Bumps [dotnet-reportgenerator-globaltool](https://github.com/danielpalme/ReportGenerator) from 5.3.9 to 5.3.10. - [Release notes](https://github.com/danielpalme/ReportGenerator/releases) - [Commits](https://github.com/danielpalme/ReportGenerator/compare/v5.3.9...v5.3.10) --- updated-dependencies: - dependency-name: dotnet-reportgenerator-globaltool dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index b2833ad..af9b561 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-reportgenerator-globaltool": { - "version": "5.3.9", + "version": "5.3.10", "commands": [ "reportgenerator" ] From 004238d5c9271321213a29339d79fddda8005c5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 20 Oct 2024 17:52:13 +0200 Subject: [PATCH 08/19] Bump Verify.MSTest from 26.6.0 to 27.0.1 (#167) Bumps [Verify.MSTest](https://github.com/VerifyTests/Verify) from 26.6.0 to 27.0.1. - [Release notes](https://github.com/VerifyTests/Verify/releases) - [Commits](https://github.com/VerifyTests/Verify/compare/26.6.0...27.0.1) --- updated-dependencies: - dependency-name: Verify.MSTest dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Akade.IndexedSet.InternalSourceGenerator.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index a3d44a7..9e5c893 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -16,7 +16,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + From 08a933cb416478880d6cd6762a5a6e77a812e8c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 20 Oct 2024 18:00:08 +0200 Subject: [PATCH 09/19] Bump Verify.DiffPlex from 3.1.0 to 3.1.2 (#166) Bumps [Verify.DiffPlex](https://github.com/VerifyTests/Verify.DiffPlex) from 3.1.0 to 3.1.2. - [Release notes](https://github.com/VerifyTests/Verify.DiffPlex/releases) - [Commits](https://github.com/VerifyTests/Verify.DiffPlex/compare/3.1.0...3.1.2) --- updated-dependencies: - dependency-name: Verify.DiffPlex dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Akade.IndexedSet.InternalSourceGenerator.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index 9e5c893..beed0ce 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -15,7 +15,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From b699cc1120c07885057dab354270b98c7d98c342 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 20 Oct 2024 18:03:48 +0200 Subject: [PATCH 10/19] Bump dotnet-reportgenerator-globaltool from 5.3.10 to 5.3.11 (#165) Bumps [dotnet-reportgenerator-globaltool](https://github.com/danielpalme/ReportGenerator) from 5.3.10 to 5.3.11. - [Release notes](https://github.com/danielpalme/ReportGenerator/releases) - [Commits](https://github.com/danielpalme/ReportGenerator/compare/v5.3.10...v5.3.11) --- updated-dependencies: - dependency-name: dotnet-reportgenerator-globaltool dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index af9b561..d235bb8 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-reportgenerator-globaltool": { - "version": "5.3.10", + "version": "5.3.11", "commands": [ "reportgenerator" ] From a28c9212afde6d39b097fddfbc3daf4f497b6ac5 Mon Sep 17 00:00:00 2001 From: Alex <16369295+akade@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:49:32 +0200 Subject: [PATCH 11/19] .NET 6 is dead - long live .NET 9 (#170) * Removed .NET 6, some code cleanup & .net 9 started * Updated project files to replace MSTest references with non-MSTest counterparts and updated reference assemblies to `ReferenceAssemblies.Net.Net90` * Fixed ranges & pipelines --- .github/workflows/ci-build.yml | 5 +- .github/workflows/codeql-analysis.yml | 4 +- .github/workflows/publish-to-nuget-org.yml | 5 +- .../Akade.IndexedSet.Benchmarks.csproj | 2 +- .../ConcurrentSetBenchmarks.cs | 2 +- .../FullTextIndexBenchmarks.cs | 2 +- .../MultiValueIndexBenchmarks.cs | 2 +- .../PrefixIndexBenchmarks.cs | 2 +- .../RangeIndexBenchmarks.cs | 2 +- .../EventHandlers.cs | 2 +- .../QueryBenchmarks.cs | 2 +- .../RehydrationBenchmark.cs | 2 +- .../UniqueLookupBenchmarks.cs | 2 +- .../Akade.IndexedSet.Tests.csproj | 2 +- .../BaseIndexTest.RangeQueries.cs | 10 +- .../CommonIndexTests/BaseIndexTest.cs | 8 +- .../CommonIndexTests.FullText.cs | 12 +-- .../CommonIndexTests.MultiRange.cs | 12 +-- .../CommonIndexTests.NonUnique.cs | 12 +-- .../CommonIndexTests.Prefix.cs | 12 +-- .../CommonIndexTests.Range.cs | 12 +-- .../CommonIndexTests.Unique.cs | 12 +-- .../CommonIndexTests/SimpleTestData.cs | 10 +- .../DataStructures/BinaryHeapTests.cs | 38 +++---- .../DataStructures/SuffixTrieTests.cs | 2 + .../DataStructures/TrieTests.cs | 2 + Akade.IndexedSet.Tests/FullTextIndices.cs | 6 +- Akade.IndexedSet.Tests/GeneralTests.cs | 4 +- Akade.IndexedSet.Tests/MultiValueIndices.cs | 8 +- Akade.IndexedSet.Tests/NonUniqueIndices.cs | 16 +-- Akade.IndexedSet.Tests/PrefixIndices.cs | 6 +- Akade.IndexedSet.Tests/RangeIndices.cs | 50 +++++----- .../Samples/Appointments/AppointmentSample.cs | 2 + .../Samples/Graph/GraphSample.cs | 10 +- Akade.IndexedSet.Tests/Samples/Graph/Node.cs | 12 +-- Akade.IndexedSet.Tests/Samples/Readme.cs | 8 +- .../Samples/Search/SearchSamples.cs | 2 +- .../TestUtilities/IndexAssert.cs | 14 +-- Akade.IndexedSet.Tests/UniqueIndices.cs | 8 +- Akade.IndexedSet/Akade.IndexedSet.csproj | 4 +- .../CompatibilitySuppressions.xml | 10 -- .../Concurrency/ConcurrentIndexedSet.cs | 11 +-- .../Concurrency/ReaderWriterLockEx.cs | 18 +--- Akade.IndexedSet/DataStructures/BinaryHeap.cs | 2 +- Akade.IndexedSet/DataStructures/Lookup.cs | 4 +- .../DataStructures/SortedLookup.cs | 8 +- Akade.IndexedSet/DataStructures/Trie.cs | 8 +- Akade.IndexedSet/Experiments.cs | 49 +--------- Akade.IndexedSet/IndexedSet.cs | 98 ++++++++----------- Akade.IndexedSet/IndexedSetBuilder.cs | 51 ++++------ Akade.IndexedSet/Indices/FullTextIndex.cs | 4 +- Akade.IndexedSet/Indices/Index.cs | 9 +- Akade.IndexedSet/Indices/IndexWriter.cs | 24 ++--- Akade.IndexedSet/Indices/MultiRangeIndex.cs | 25 ++--- Akade.IndexedSet/Indices/NonUniqueIndex.cs | 6 +- Akade.IndexedSet/Indices/PrefixIndex.cs | 9 +- Akade.IndexedSet/Indices/RangeIndex.cs | 25 ++--- Akade.IndexedSet/Indices/TypedIndex.cs | 12 +-- Akade.IndexedSet/Indices/UniqueIndex.cs | 10 +- .../PublicAPI/net6.0/PublicAPI.Shipped.txt | 4 - .../PublicAPI/net6.0/PublicAPI.Unshipped.txt | 0 .../PublicAPI/net8.0/PublicAPI.Shipped.txt | 0 .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 0 .../Akade.IndexedSet.Analyzers.Test.csproj | 14 +-- ...adMethodDoesNotContainWriteMethodAccess.cs | 1 - .../SampleCodeGenerator.cs | 28 +++--- .../Verifiers/CSharpAnalyzerVerifier+Test.cs | 7 +- .../Verifiers/CSharpAnalyzerVerifier.cs | 8 +- .../Verifiers/CSharpCodeFixVerifier`2+Test.cs | 7 +- .../Verifiers/CSharpCodeFixVerifier`2.cs | 9 +- .../Verifiers/CSharpVerifierHelper.cs | 2 +- .../Akade.IndexedSet.Analyzers.csproj | 2 +- ...AkadeIndexedSetAnalyzersCodeFixProvider.cs | 9 +- .../ConcurrentSetUsageAnalyzers.cs | 2 +- .../IndexNamingRulesAnalyzer.cs | 2 +- ...edSet.InternalSourceGenerator.Tests.csproj | 2 +- .../TestHelper.cs | 11 +-- ....IndexedSet.InternalSourceGenerator.csproj | 2 +- 78 files changed, 324 insertions(+), 497 deletions(-) delete mode 100644 Akade.IndexedSet/CompatibilitySuppressions.xml delete mode 100644 Akade.IndexedSet/PublicAPI/net6.0/PublicAPI.Shipped.txt delete mode 100644 Akade.IndexedSet/PublicAPI/net6.0/PublicAPI.Unshipped.txt delete mode 100644 Akade.IndexedSet/PublicAPI/net8.0/PublicAPI.Shipped.txt delete mode 100644 Akade.IndexedSet/PublicAPI/net8.0/PublicAPI.Unshipped.txt diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 3202b04..51ec7c7 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -17,9 +17,8 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 6.x - 7.x - 8.x + 8.x + 9.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d81bb6d..88b6b75 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -53,7 +53,9 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.x + dotnet-version: | + 8.x + 9.x - name: Build run: dotnet build diff --git a/.github/workflows/publish-to-nuget-org.yml b/.github/workflows/publish-to-nuget-org.yml index 411f7e3..7af9dd7 100644 --- a/.github/workflows/publish-to-nuget-org.yml +++ b/.github/workflows/publish-to-nuget-org.yml @@ -15,9 +15,8 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 6.x - 7.x - 8.x + 8.x + 9.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj index 0233bbf..38dd733 100644 --- a/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj +++ b/Akade.IndexedSet.Benchmarks/Akade.IndexedSet.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net6.0;net8.0 + net8.0;net9.0 enable enable false diff --git a/Akade.IndexedSet.Benchmarks/ConcurrentSetBenchmarks.cs b/Akade.IndexedSet.Benchmarks/ConcurrentSetBenchmarks.cs index 6c1c2e3..de1e539 100644 --- a/Akade.IndexedSet.Benchmarks/ConcurrentSetBenchmarks.cs +++ b/Akade.IndexedSet.Benchmarks/ConcurrentSetBenchmarks.cs @@ -7,8 +7,8 @@ namespace Akade.IndexedSet.Benchmarks; [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] [MemoryDiagnoser] -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] [JsonExporter] public class ConcurrentSetBenchmarks { diff --git a/Akade.IndexedSet.Benchmarks/FullTextIndexBenchmarks.cs b/Akade.IndexedSet.Benchmarks/FullTextIndexBenchmarks.cs index cba600a..25afddf 100644 --- a/Akade.IndexedSet.Benchmarks/FullTextIndexBenchmarks.cs +++ b/Akade.IndexedSet.Benchmarks/FullTextIndexBenchmarks.cs @@ -5,8 +5,8 @@ namespace Akade.IndexedSet.Benchmarks; [MemoryDiagnoser] [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] [JsonExporter] public class FullTextIndexBenchmarks { diff --git a/Akade.IndexedSet.Benchmarks/MultiValueIndexBenchmarks.cs b/Akade.IndexedSet.Benchmarks/MultiValueIndexBenchmarks.cs index cce8296..9c5cb1a 100644 --- a/Akade.IndexedSet.Benchmarks/MultiValueIndexBenchmarks.cs +++ b/Akade.IndexedSet.Benchmarks/MultiValueIndexBenchmarks.cs @@ -4,8 +4,8 @@ namespace Akade.IndexedSet.Benchmarks; [MemoryDiagnoser] [DisassemblyDiagnoser] -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] [JsonExporter] public class MultiValueIndexBenchmarks { diff --git a/Akade.IndexedSet.Benchmarks/PrefixIndexBenchmarks.cs b/Akade.IndexedSet.Benchmarks/PrefixIndexBenchmarks.cs index 141760a..76adc72 100644 --- a/Akade.IndexedSet.Benchmarks/PrefixIndexBenchmarks.cs +++ b/Akade.IndexedSet.Benchmarks/PrefixIndexBenchmarks.cs @@ -5,8 +5,8 @@ namespace Akade.IndexedSet.Benchmarks; [MemoryDiagnoser] [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] [JsonExporter] public class PrefixIndexBenchmarks { diff --git a/Akade.IndexedSet.Benchmarks/RangeIndexBenchmarks.cs b/Akade.IndexedSet.Benchmarks/RangeIndexBenchmarks.cs index 5c5bcdb..6716fe3 100644 --- a/Akade.IndexedSet.Benchmarks/RangeIndexBenchmarks.cs +++ b/Akade.IndexedSet.Benchmarks/RangeIndexBenchmarks.cs @@ -5,8 +5,8 @@ namespace Akade.IndexedSet.Benchmarks; [MemoryDiagnoser] [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] [JsonExporter] public class RangeIndexBenchmarks { diff --git a/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/EventHandlers.cs b/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/EventHandlers.cs index 1646439..d45ac58 100644 --- a/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/EventHandlers.cs +++ b/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/EventHandlers.cs @@ -23,7 +23,7 @@ private static void HandleEvent(ConcurrentIndexedSet sta private static void HandleEvent(ConcurrentIndexedSet state, AggregateAdded @event) { - _ = state.Add(new Aggregate(@event.Id, @event.Owner, ImmutableHashSet.Empty, @event.ExternalId, @event.FirstName, @event.LastName)); + _ = state.Add(new Aggregate(@event.Id, @event.Owner, [], @event.ExternalId, @event.FirstName, @event.LastName)); } internal static void HandleEvents(ConcurrentIndexedSet state, IEnumerable events) diff --git a/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/QueryBenchmarks.cs b/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/QueryBenchmarks.cs index 116a133..2577512 100644 --- a/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/QueryBenchmarks.cs +++ b/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/QueryBenchmarks.cs @@ -4,8 +4,8 @@ namespace Akade.IndexedSet.Benchmarks.RealWorld.EventSourcedAggregateCache; -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] public class QueryBenchmarks { private readonly ConcurrentIndexedSet _set = IndexedSetBuilder.Create(x => x.Id) diff --git a/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/RehydrationBenchmark.cs b/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/RehydrationBenchmark.cs index d7893c9..bb33ab8 100644 --- a/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/RehydrationBenchmark.cs +++ b/Akade.IndexedSet.Benchmarks/RealWorld/EventSourcedAggregateCache/RehydrationBenchmark.cs @@ -5,8 +5,8 @@ namespace Akade.IndexedSet.Benchmarks.RealWorld; -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] public class RehydrationBenchmark { private readonly ConcurrentIndexedSet _set = IndexedSetBuilder.Create(x => x.Id) diff --git a/Akade.IndexedSet.Benchmarks/UniqueLookupBenchmarks.cs b/Akade.IndexedSet.Benchmarks/UniqueLookupBenchmarks.cs index 79bfd33..7550df6 100644 --- a/Akade.IndexedSet.Benchmarks/UniqueLookupBenchmarks.cs +++ b/Akade.IndexedSet.Benchmarks/UniqueLookupBenchmarks.cs @@ -4,8 +4,8 @@ namespace Akade.IndexedSet.Benchmarks; [MemoryDiagnoser] [DisassemblyDiagnoser] -[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net60)] [SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net80)] +[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.Net90)] [JsonExporter] public class UniqueIndexBenchmarks { diff --git a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj index c02debd..4eb4cd9 100644 --- a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj +++ b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0;net9.0 enable enable false diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.RangeQueries.cs b/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.RangeQueries.cs index 0a8a81f..2030c10 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.RangeQueries.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.RangeQueries.cs @@ -42,7 +42,7 @@ public void Range_returns_sorted_elements_respecting_boundary_parameters_for_uni TElement[] data = GetUniqueData(); AddElements(data, index); - TElement[] orderedElements = data.OrderBy(_keyAccessor).ToArray(); + TElement[] orderedElements = [.. data.OrderBy(_keyAccessor)]; TIndexKey rangeStart = _keyAccessor(orderedElements[1]); TIndexKey rangeEnd = _keyAccessor(orderedElements[^2]); @@ -74,7 +74,7 @@ public void Comparison_queries_return_sorted_elements_respecting_boundary() TIndex index = CreateIndex(); TElement[] data = GetUniqueData(); AddElements(data, index); - TElement[] orderedElements = data.OrderBy(_keyAccessor).ToArray(); + TElement[] orderedElements = [.. data.OrderBy(_keyAccessor)]; TIndexKey boundary = _keyAccessor(orderedElements[3]); CollectionAssert.AreEqual(orderedElements[0..3], index.LessThan(boundary).ToArray()); @@ -115,7 +115,7 @@ public void MaxMin_return_correct_key_and_values() TElement[] data = GetUniqueData(); AddElements(data, index); - TElement[] orderedElements = data.OrderBy(_keyAccessor).ToArray(); + TElement[] orderedElements = [.. data.OrderBy(_keyAccessor)]; Assert.AreEqual(_keyAccessor(orderedElements[0]), index.Min()); Assert.AreEqual(orderedElements[0], index.MinBy().Single()); @@ -155,7 +155,7 @@ public void OrderBy_returns_sorted_values() TIndex index = CreateIndex(); TElement[] data = GetUniqueData(); AddElements(data, index); - TElement[] orderedElements = data.OrderBy(_keyAccessor).ToArray(); + TElement[] orderedElements = [.. data.OrderBy(_keyAccessor)]; for (int i = 0; i < orderedElements.Length; i++) { @@ -194,7 +194,7 @@ public void OrderByDescending_returns_sorted_values() TIndex index = CreateIndex(); TElement[] data = GetUniqueData(); AddElements(data, index); - TElement[] orderedElements = data.OrderByDescending(_keyAccessor).ToArray(); + TElement[] orderedElements = [.. data.OrderByDescending(_keyAccessor)]; for (int i = 0; i < orderedElements.Length; i++) { diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.cs b/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.cs index 66f96b7..4035c16 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/BaseIndexTest.cs @@ -3,15 +3,11 @@ using System.Reflection; namespace Akade.IndexedSet.Tests.CommonIndexTests; -internal abstract partial class BaseIndexTest +internal abstract partial class BaseIndexTest(Func keyAccessor) where TIndex : TypedIndex where TIndexKey : notnull { - private readonly Func _keyAccessor; - public BaseIndexTest(Func keyAccessor) - { - _keyAccessor = keyAccessor; - } + private readonly Func _keyAccessor = keyAccessor; protected abstract TElement[] GetUniqueData(); diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.FullText.cs b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.FullText.cs index 5935797..4b98a66 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.FullText.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.FullText.cs @@ -30,21 +30,21 @@ protected override string GetNotExistingKey() protected override Container[] GetNonUniqueData() { - return new Container[] - { + return + [ new("Mice"), new("Possum"), new("Possum"), new("Rat"), new("Rat"), new("Rabbit"), - }; + ]; } protected override Container[] GetUniqueData() { - return new Container[] - { + return + [ new("Common snapping turtle"), new("Common mallard"), new("Domestic dog"), @@ -52,7 +52,7 @@ protected override Container[] GetUniqueData() new("Mice"), new("Rabbit"), new("Possum"), - }; + ]; } } diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.MultiRange.cs b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.MultiRange.cs index a08fa10..b0f469f 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.MultiRange.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.MultiRange.cs @@ -23,28 +23,28 @@ protected override MultiRangeIndex, int> CreateIndex() protected override Container[] GetNonUniqueData() { - return new Container[] - { + return + [ new(11), new(11), new(12), new(12), new(13), new(13), - }; + ]; } protected override Container[] GetUniqueData() { - return new Container[] - { + return + [ new(1), new(2), new(3), new(4), new(5), new(6), - }; + ]; } } diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.NonUnique.cs b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.NonUnique.cs index bfd2558..19fe286 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.NonUnique.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.NonUnique.cs @@ -21,28 +21,28 @@ protected override NonUniqueIndex, int> CreateIndex() protected override Container[] GetNonUniqueData() { - return new Container[] - { + return + [ new(11), new(11), new(12), new(12), new(13), new(13), - }; + ]; } protected override Container[] GetUniqueData() { - return new Container[] - { + return + [ new(1), new(2), new(3), new(4), new(5), new(6), - }; + ]; } } diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Prefix.cs b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Prefix.cs index bc97f81..dfb95d7 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Prefix.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Prefix.cs @@ -29,21 +29,21 @@ protected override string GetNotExistingKey() protected override Container[] GetNonUniqueData() { - return new Container[] - { + return + [ new("Mice"), new("Possum"), new("Possum"), new("Rat"), new("Rat"), new("Rabbit"), - }; + ]; } protected override Container[] GetUniqueData() { - return new Container[] - { + return + [ new("Common snapping turtle"), new("Common mallard"), new("Domestic dog"), @@ -51,7 +51,7 @@ protected override Container[] GetUniqueData() new("Mice"), new("Rabbit"), new("Possum"), - }; + ]; } } diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Range.cs b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Range.cs index 9fa69a2..b75c00b 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Range.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Range.cs @@ -23,28 +23,28 @@ protected override RangeIndex, int> CreateIndex() protected override Container[] GetNonUniqueData() { - return new Container[] - { + return + [ new(11), new(11), new(12), new(12), new(13), new(13), - }; + ]; } protected override Container[] GetUniqueData() { - return new Container[] - { + return + [ new(1), new(2), new(3), new(4), new(5), new(6), - }; + ]; } } diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Unique.cs b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Unique.cs index f5765cf..792c28a 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Unique.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/CommonIndexTests.Unique.cs @@ -22,28 +22,28 @@ protected override UniqueIndex, int> CreateIndex() protected override Container[] GetNonUniqueData() { - return new Container[] - { + return + [ new(11), new(11), new(12), new(12), new(13), new(13), - }; + ]; } protected override Container[] GetUniqueData() { - return new Container[] - { + return + [ new(1), new(2), new(3), new(4), new(5), new(6), - }; + ]; } } diff --git a/Akade.IndexedSet.Tests/CommonIndexTests/SimpleTestData.cs b/Akade.IndexedSet.Tests/CommonIndexTests/SimpleTestData.cs index e5a3288..0db3601 100644 --- a/Akade.IndexedSet.Tests/CommonIndexTests/SimpleTestData.cs +++ b/Akade.IndexedSet.Tests/CommonIndexTests/SimpleTestData.cs @@ -3,13 +3,7 @@ namespace Akade.IndexedSet.Tests.CommonIndexTests; [DebuggerDisplay($"{{{nameof(Value)}}}")] -internal class Container +internal class Container(T value) { - public Container(T value) - { - - Value = value; - } - - public T Value { get; } + public T Value { get; } = value; } diff --git a/Akade.IndexedSet.Tests/DataStructures/BinaryHeapTests.cs b/Akade.IndexedSet.Tests/DataStructures/BinaryHeapTests.cs index 24d7945..f2dcda0 100644 --- a/Akade.IndexedSet.Tests/DataStructures/BinaryHeapTests.cs +++ b/Akade.IndexedSet.Tests/DataStructures/BinaryHeapTests.cs @@ -1,9 +1,11 @@ using Akade.IndexedSet.DataStructures; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Diagnostics.CodeAnalysis; namespace Akade.IndexedSet.Tests.DataStructures; [TestClass] +[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments", Justification = "In unit tests: readability > performance")] public class BinaryHeapTests { private BinaryHeap _heap = null!; @@ -11,7 +13,7 @@ public class BinaryHeapTests [TestInitialize] public void TestInitialize() { - _heap = new(); + _heap = []; } [TestMethod] @@ -30,7 +32,7 @@ public void adding_random_values_including_duplicates_gives_sorted_list_and_corr [TestMethod] public void removing_random_values_from_heap_preserves_sorted_list_and_reports_correct_removal_positions() { - _heap.AddRange(new[] { 1, 2, 4, 4, 6, 6, 8, 9 }); + _heap.AddRange([1, 2, 4, 4, 6, 6, 8, 9]); Assert.AreEqual(5, _heap.RemoveValue(6)); // 1 2 4 4 6 8 9 Assert.AreEqual(4, _heap.RemoveValue(6)); // 1 2 4 4 8 9 @@ -42,7 +44,7 @@ public void removing_random_values_from_heap_preserves_sorted_list_and_reports_c [TestMethod] public void querying_by_single_values_returns_correct_ranges() { - _heap.AddRange(new[] { 1, 2, 4, 4, 4, 4, 6, 6, 8, 9 }); + _heap.AddRange([1, 2, 4, 4, 4, 4, 6, 6, 8, 9]); Assert.AreEqual(0..1, _heap.GetRange(1)); Assert.AreEqual(1..2, _heap.GetRange(2)); @@ -85,12 +87,12 @@ public void querying_by_range_values_returns_correct_position_with_zero_length_w [TestMethod] public void querying_by_range_returns_correct_ranges() { - // 0 1 2 3 4 5 6 7 8 9 - _heap.AddRange(new[] { 1, 2, 4, 4, 4, 4, 6, 6, 8, 9 }); - // case 1: 0 1 - // case 2: 0 - - - - - - - - 9 - // case 3: 1 - - - 5 - // case 4: 2 - - - - 7 + // 0 1 2 3 4 5 6 7 8 9 + _heap.AddRange([1, 2, 4, 4, 4, 4, 6, 6, 8, 9]); + // case 1: 0 1 + // case 2: 0 - - - - - - - - 9 + // case 3: 1 - - - 5 + // case 4: 2 - - - - 7 Assert.AreEqual(0..2, _heap.GetRange(0, 3)); Assert.AreEqual(0..10, _heap.GetRange(0, 10)); @@ -102,12 +104,12 @@ public void querying_by_range_returns_correct_ranges() [TestMethod] public void querying_by_range_returns_correct_ranges_respecting_inclusive_or_exclusive_boundaries_when_boundaries_are_elements() { - // 0 1 2 3 4 5 6 7 8 9 10 - _heap.AddRange(new[] { 1, 2, 4, 4, 4, 4, 5, 6, 6, 8, 9 }); - // case 1: 6 - 8 - // case 1: 2 - - - - - 8 - // case 1: 6 - - 9 - // case 1: 2 - - - - - - 9 + // 0 1 2 3 4 5 6 7 8 9 10 + _heap.AddRange([1, 2, 4, 4, 4, 4, 5, 6, 6, 8, 9]); + // case 1: 6 - 8 + // case 1: 2 - - - - - 8 + // case 1: 6 - - 9 + // case 1: 2 - - - - - - 9 Assert.AreEqual(6..9, _heap.GetRange(4, 8, inclusiveStart: false, inclusiveEnd: false)); Assert.AreEqual(2..9, _heap.GetRange(4, 8, inclusiveStart: true, inclusiveEnd: false)); @@ -118,9 +120,9 @@ public void querying_by_range_returns_correct_ranges_respecting_inclusive_or_exc [TestMethod] public void querying_by_range_returns_correct_ranges_respecting_inclusive_or_exclusive_boundaries_when_boundaries_are_not_elements() { - // 0 1 2 3 4 5 6 7 8 9 10 - _heap.AddRange(new[] { 1, 2, 4, 4, 4, 4, 5, 6, 6, 8, 9 }); - // all cases: 2 - - - - - 8 + // 0 1 2 3 4 5 6 7 8 9 10 + _heap.AddRange([1, 2, 4, 4, 4, 4, 5, 6, 6, 8, 9]); + // all cases: 2 - - - - - 8 Assert.AreEqual(2..9, _heap.GetRange(3, 7, inclusiveStart: false, inclusiveEnd: false)); Assert.AreEqual(2..9, _heap.GetRange(3, 7, inclusiveStart: true, inclusiveEnd: false)); diff --git a/Akade.IndexedSet.Tests/DataStructures/SuffixTrieTests.cs b/Akade.IndexedSet.Tests/DataStructures/SuffixTrieTests.cs index 73563d7..1d45955 100644 --- a/Akade.IndexedSet.Tests/DataStructures/SuffixTrieTests.cs +++ b/Akade.IndexedSet.Tests/DataStructures/SuffixTrieTests.cs @@ -1,9 +1,11 @@ using Akade.IndexedSet.DataStructures; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Diagnostics.CodeAnalysis; namespace Akade.IndexedSet.Tests.DataStructures; [TestClass] +[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments", Justification = "In unit tests: readability > performance")] public class SuffixTrieTests { private SuffixTrie _trie = default!; diff --git a/Akade.IndexedSet.Tests/DataStructures/TrieTests.cs b/Akade.IndexedSet.Tests/DataStructures/TrieTests.cs index 2ab4990..191d947 100644 --- a/Akade.IndexedSet.Tests/DataStructures/TrieTests.cs +++ b/Akade.IndexedSet.Tests/DataStructures/TrieTests.cs @@ -1,9 +1,11 @@ using Akade.IndexedSet.DataStructures; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Diagnostics.CodeAnalysis; namespace Akade.IndexedSet.Tests.DataStructures; [TestClass] +[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments", Justification = "In unit tests: readability > performance")] public class TrieTests { private readonly Trie _trie = GetAnimalTrie(); diff --git a/Akade.IndexedSet.Tests/FullTextIndices.cs b/Akade.IndexedSet.Tests/FullTextIndices.cs index 338f67b..0a2c260 100644 --- a/Akade.IndexedSet.Tests/FullTextIndices.cs +++ b/Akade.IndexedSet.Tests/FullTextIndices.cs @@ -61,8 +61,8 @@ public void single_item_retrieval_throws_exception_if_there_is_more_than_one_res [TestMethod] public void multi_item_retrieval_works() { - _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: new[] { _bonobo, _borador, _tiger, _tapir, _panther, _pangolin }); - _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: new[] { _booby, _penguin, _parrot }); + _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: [_bonobo, _borador, _tiger, _tapir, _panther, _pangolin]); + _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: [_booby, _penguin, _parrot]); } [TestMethod] @@ -106,7 +106,7 @@ public void TryGetSingle() [Experimental(Experiments.TextSearchImprovements)] public void Retrieval_via_multi_key_retrieves_correct_items() { - static IEnumerable Multikeys(Animal d) => new[] { d.Name, d.Category }; + static IEnumerable Multikeys(Animal d) => [d.Name, d.Category]; var data = new Animal[] { _bonobo, diff --git a/Akade.IndexedSet.Tests/GeneralTests.cs b/Akade.IndexedSet.Tests/GeneralTests.cs index fa078cf..f1f9cd1 100644 --- a/Akade.IndexedSet.Tests/GeneralTests.cs +++ b/Akade.IndexedSet.Tests/GeneralTests.cs @@ -17,7 +17,7 @@ public class GeneralTests [TestInitialize] public void Init() { - TestData[] data = new[] { _a, _b, _c, _d, _e }; + TestData[] data = [_a, _b, _c, _d, _e]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithIndex(x => x.IntProperty) .WithIndex(x => x.WritableProperty) @@ -84,7 +84,7 @@ public void Adding_multiple_items_with_a_conflicting_item_should_keep_the_set_in .WithIndex(x => x.GuidProperty) .WithUniqueIndex(x => x.IntProperty) .Build(); - TestData[] dataToAdd = new[] { _d, _b, _e }; + TestData[] dataToAdd = [_d, _b, _e]; _ = Assert.ThrowsException(() => set.AddRange(dataToAdd)); Assert.AreEqual(2, set.Count); diff --git a/Akade.IndexedSet.Tests/MultiValueIndices.cs b/Akade.IndexedSet.Tests/MultiValueIndices.cs index 76b1651..828586e 100644 --- a/Akade.IndexedSet.Tests/MultiValueIndices.cs +++ b/Akade.IndexedSet.Tests/MultiValueIndices.cs @@ -7,10 +7,10 @@ namespace Akade.IndexedSet.Tests; public class MultiValueIndices { private IndexedSet _indexedSet = null!; - private readonly DenormalizedTestData _a = new(0, new[] { 1, 2, 3, 4 }); - private readonly DenormalizedTestData _b = new(1, new[] { 2, 3 }); - private readonly DenormalizedTestData _c = new(2, new[] { 3 }); - private readonly DenormalizedTestData _d = new(3, new[] { 1, 2, 3 }); + private readonly DenormalizedTestData _a = new(0, [1, 2, 3, 4]); + private readonly DenormalizedTestData _b = new(1, [2, 3]); + private readonly DenormalizedTestData _c = new(2, [3]); + private readonly DenormalizedTestData _d = new(3, [1, 2, 3]); [TestInitialize] public void Init() diff --git a/Akade.IndexedSet.Tests/NonUniqueIndices.cs b/Akade.IndexedSet.Tests/NonUniqueIndices.cs index b42ad2f..7750dd7 100644 --- a/Akade.IndexedSet.Tests/NonUniqueIndices.cs +++ b/Akade.IndexedSet.Tests/NonUniqueIndices.cs @@ -17,7 +17,7 @@ public class NonUniqueIndices [TestInitialize] public void Init() { - TestData[] data = new[] { _a, _b, _c, _d, _e }; + TestData[] data = [_a, _b, _c, _d, _e]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithIndex(x => x.IntProperty) .WithIndex(x => x.GuidProperty) @@ -28,9 +28,9 @@ public void Init() [TestMethod] public void retrieval_via_secondary_int_key_returns_correct_items() { - _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: new[] { _a, _b }); + _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: [_a, _b]); _indexedSet.AssertSingleItem(x => x.IntProperty, _c); - _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: [_d, _e]); } [TestMethod] @@ -39,7 +39,7 @@ public void retrieval_via_secondary_guid_key_returns_correct_items() _indexedSet.AssertSingleItem(x => x.GuidProperty, _a); _indexedSet.AssertSingleItem(x => x.GuidProperty, _b); _indexedSet.AssertSingleItem(x => x.GuidProperty, _c); - _indexedSet.AssertMultipleItems(x => x.GuidProperty, expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItems(x => x.GuidProperty, expectedElements: [_d, _e]); } [TestMethod] @@ -47,7 +47,7 @@ public void retrieval_via_secondary_string_key_returns_correct_items() { _indexedSet.AssertSingleItem(x => x.StringProperty, _a); _indexedSet.AssertSingleItem(x => x.StringProperty, _b); - _indexedSet.AssertMultipleItems(x => x.StringProperty, expectedElements: new[] { _c, _d, _e }); + _indexedSet.AssertMultipleItems(x => x.StringProperty, expectedElements: [_c, _d, _e]); } [TestMethod] @@ -60,7 +60,7 @@ public void range_queries_throw_exception() [TestMethod] public void retrieval_via_compound_key_returns_correct_items() { - TestData[] data = new[] { _a, _b, _c, _d, _e }; + TestData[] data = [_a, _b, _c, _d, _e]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithIndex(x => (x.IntProperty, x.StringProperty)) .Build(); @@ -68,7 +68,7 @@ public void retrieval_via_compound_key_returns_correct_items() _indexedSet.AssertSingleItem(x => (x.IntProperty, x.StringProperty), _a); _indexedSet.AssertSingleItem(x => (x.IntProperty, x.StringProperty), _b); _indexedSet.AssertSingleItem(x => (x.IntProperty, x.StringProperty), _c); - _indexedSet.AssertMultipleItems(x => (x.IntProperty, x.StringProperty), expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItems(x => (x.IntProperty, x.StringProperty), expectedElements: [_d, _e]); } [TestMethod] @@ -82,7 +82,7 @@ public void Removal() [TestMethod] public void string_query_selects_the_correct_where_overload() { - _indexedSet.AssertMultipleItems(x => x.StringProperty, expectedElements: new[] { _c, _d, _e }); + _indexedSet.AssertMultipleItems(x => x.StringProperty, expectedElements: [_c, _d, _e]); Assert.AreEqual(_a, _indexedSet.Where(x => x.StringProperty, "AA").Single()); } diff --git a/Akade.IndexedSet.Tests/PrefixIndices.cs b/Akade.IndexedSet.Tests/PrefixIndices.cs index 49e11f3..5a6c664 100644 --- a/Akade.IndexedSet.Tests/PrefixIndices.cs +++ b/Akade.IndexedSet.Tests/PrefixIndices.cs @@ -61,8 +61,8 @@ public void single_item_retrieval_throws_exception_if_there_is_more_than_one_res [TestMethod] public void multi_item_retrieval_works() { - _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: new[] { _bonobo, _borador, _tiger, _tapir, _panther, _pangolin }); - _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: new[] { _booby, _penguin, _parrot }); + _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: [_bonobo, _borador, _tiger, _tapir, _panther, _pangolin]); + _indexedSet.AssertMultipleItems(x => x.Category, expectedElements: [_booby, _penguin, _parrot]); } [TestMethod] @@ -93,7 +93,7 @@ public void TryGetSingle() [Experimental(Experiments.TextSearchImprovements)] public void Retrieval_via_multi_key_retrieves_correct_items() { - static IEnumerable Multikeys(Animal d) => new[] { d.Name, d.Category }; + static IEnumerable Multikeys(Animal d) => [d.Name, d.Category]; var data = new Animal[] { _bonobo, diff --git a/Akade.IndexedSet.Tests/RangeIndices.cs b/Akade.IndexedSet.Tests/RangeIndices.cs index 9661d9d..8ca886b 100644 --- a/Akade.IndexedSet.Tests/RangeIndices.cs +++ b/Akade.IndexedSet.Tests/RangeIndices.cs @@ -17,7 +17,7 @@ public class RangeIndices [TestInitialize] public void Init() { - TestData[] data = new[] { _a, _b, _c, _d, _e }; + TestData[] data = [_a, _b, _c, _d, _e]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithRangeIndex(x => x.IntProperty) .WithRangeIndex(x => x.GuidProperty) @@ -28,45 +28,45 @@ public void Init() [TestMethod] public void range_query_on_ints_returns_correct_items() { - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 3, 25, inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _a, _b, _c, _d, _e }); - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 8, 12, inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _a, _b, _c }); - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 11, 14, inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _c, _d, _e }); - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 12, 14, inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 3, 25, inclusiveStart: true, inclusiveEnd: false, expectedElements: [_a, _b, _c, _d, _e]); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 8, 12, inclusiveStart: true, inclusiveEnd: false, expectedElements: [_a, _b, _c]); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 11, 14, inclusiveStart: true, inclusiveEnd: false, expectedElements: [_c, _d, _e]); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 12, 14, inclusiveStart: true, inclusiveEnd: false, expectedElements: [_d, _e]); } [TestMethod] public void range_query_on_ints_correctly_respects_inclusive_or_exclusive_boundaries() { - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: false, inclusiveEnd: false, expectedElements: new[] { _c }); - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _a, _b, _c }); - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: false, inclusiveEnd: true, expectedElements: new[] { _c, _d, _e }); - _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: true, inclusiveEnd: true, expectedElements: new[] { _a, _b, _c, _d, _e }); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: false, inclusiveEnd: false, expectedElements: [_c]); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: true, inclusiveEnd: false, expectedElements: [_a, _b, _c]); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: false, inclusiveEnd: true, expectedElements: [_c, _d, _e]); + _indexedSet.AssertMultipleItemsViaRange(x => x.IntProperty, 10, 13, inclusiveStart: true, inclusiveEnd: true, expectedElements: [_a, _b, _c, _d, _e]); } [TestMethod] public void range_query_on_strings_returns_correct_items() { - _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "A", "F", inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _a, _b, _c, _d, _e }); - _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "A", "D", inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _a, _b }); - _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "D", "Z", inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _c, _d, _e }); - _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "E", "Z", inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _c, _d, _e }); + _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "A", "F", inclusiveStart: true, inclusiveEnd: false, expectedElements: [_a, _b, _c, _d, _e]); + _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "A", "D", inclusiveStart: true, inclusiveEnd: false, expectedElements: [_a, _b]); + _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "D", "Z", inclusiveStart: true, inclusiveEnd: false, expectedElements: [_c, _d, _e]); + _indexedSet.AssertMultipleItemsViaRange(x => x.StringProperty, "E", "Z", inclusiveStart: true, inclusiveEnd: false, expectedElements: [_c, _d, _e]); } [TestMethod] public void range_query_on_guids_returns_correct_items() { - _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(0), GuidGen.Get(12), inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _a, _b, _c, _d, _e }); - _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(0), GuidGen.Get(4), inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _a, _b, _c }); - _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(4), GuidGen.Get(8), inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _d, _e }); - _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(5), GuidGen.Get(8), inclusiveStart: true, inclusiveEnd: false, expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(0), GuidGen.Get(12), inclusiveStart: true, inclusiveEnd: false, expectedElements: [_a, _b, _c, _d, _e]); + _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(0), GuidGen.Get(4), inclusiveStart: true, inclusiveEnd: false, expectedElements: [_a, _b, _c]); + _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(4), GuidGen.Get(8), inclusiveStart: true, inclusiveEnd: false, expectedElements: [_d, _e]); + _indexedSet.AssertMultipleItemsViaRange(x => x.GuidProperty, GuidGen.Get(5), GuidGen.Get(8), inclusiveStart: true, inclusiveEnd: false, expectedElements: [_d, _e]); } [TestMethod] public void retrieval_via_secondary_int_key_returns_correct_items() { - _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: new[] { _a, _b }); + _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: [_a, _b]); _indexedSet.AssertSingleItem(x => x.IntProperty, _c); - _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItems(x => x.IntProperty, expectedElements: [_d, _e]); } [TestMethod] @@ -75,7 +75,7 @@ public void retrieval_via_secondary_guid_key_returns_correct_items() _indexedSet.AssertSingleItem(x => x.GuidProperty, _a); _indexedSet.AssertSingleItem(x => x.GuidProperty, _b); _indexedSet.AssertSingleItem(x => x.GuidProperty, _c); - _indexedSet.AssertMultipleItems(x => x.GuidProperty, expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItems(x => x.GuidProperty, expectedElements: [_d, _e]); } [TestMethod] @@ -83,13 +83,13 @@ public void retrieval_via_secondary_string_key_returns_correct_items() { _indexedSet.AssertSingleItem(x => x.StringProperty, _a); _indexedSet.AssertSingleItem(x => x.StringProperty, _b); - _indexedSet.AssertMultipleItems(x => x.StringProperty, expectedElements: new[] { _c, _d, _e }); + _indexedSet.AssertMultipleItems(x => x.StringProperty, expectedElements: [_c, _d, _e]); } [TestMethod] public void retrieval_via_compound_key_returns_correct_items() { - TestData[] data = new[] { _a, _b, _c, _d, _e }; + TestData[] data = [_a, _b, _c, _d, _e]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithRangeIndex(x => (x.IntProperty, x.StringProperty)) .Build(); @@ -97,7 +97,7 @@ public void retrieval_via_compound_key_returns_correct_items() _indexedSet.AssertSingleItem(x => (x.IntProperty, x.StringProperty), _a); _indexedSet.AssertSingleItem(x => (x.IntProperty, x.StringProperty), _b); _indexedSet.AssertSingleItem(x => (x.IntProperty, x.StringProperty), _c); - _indexedSet.AssertMultipleItems(x => (x.IntProperty, x.StringProperty), expectedElements: new[] { _d, _e }); + _indexedSet.AssertMultipleItems(x => (x.IntProperty, x.StringProperty), expectedElements: [_d, _e]); } [TestMethod] @@ -209,9 +209,9 @@ public void TryGetSingle_on_secondary_key() public void Retrieval_via_multi_key_retrieves_correct_items() { // duplication of primary key is intentional => tests if the range index correctly returns & counts distinct elements - static IEnumerable Multikeys(TestData x) => new[] { x.PrimaryKey, x.PrimaryKey, x.PrimaryKey + 1 }; + static IEnumerable Multikeys(TestData x) => [x.PrimaryKey, x.PrimaryKey, x.PrimaryKey + 1]; - TestData[] data = new[] { _a, _b, _c }; + TestData[] data = [_a, _b, _c]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithRangeIndex(Multikeys) .Build(); diff --git a/Akade.IndexedSet.Tests/Samples/Appointments/AppointmentSample.cs b/Akade.IndexedSet.Tests/Samples/Appointments/AppointmentSample.cs index 9a57a41..4a5f1d1 100644 --- a/Akade.IndexedSet.Tests/Samples/Appointments/AppointmentSample.cs +++ b/Akade.IndexedSet.Tests/Samples/Appointments/AppointmentSample.cs @@ -1,9 +1,11 @@ using Akade.IndexedSet.Tests.TestUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Diagnostics.CodeAnalysis; namespace Akade.IndexedSet.Tests.Samples.Appointments; [TestClass] +[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments", Justification = "In unit tests: readability > performance")] public class AppointmentSample { private readonly DateTime _todayDateTime; diff --git a/Akade.IndexedSet.Tests/Samples/Graph/GraphSample.cs b/Akade.IndexedSet.Tests/Samples/Graph/GraphSample.cs index b4bcb90..afc974b 100644 --- a/Akade.IndexedSet.Tests/Samples/Graph/GraphSample.cs +++ b/Akade.IndexedSet.Tests/Samples/Graph/GraphSample.cs @@ -1,9 +1,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; namespace Akade.IndexedSet.Tests.Samples.Graph; [TestClass] +[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments", Justification = "In unit tests: readability > performance")] public class GraphSample { [TestMethod] @@ -13,10 +15,10 @@ public void efficiently_query_incoming_edges_on_nodes() .WithIndex(x => x.ConnectedTo) // for special collections such as immutable arrays: make sure the correct overload has been selected by providing generic arguments .Build(); - _ = _graph.Add(new Node(id: 1, connectedTo: ImmutableArray.Create(2, 3, 4))); - _ = _graph.Add(new Node(id: 2, connectedTo: ImmutableArray.Create(1, 2))); - _ = _graph.Add(new Node(id: 3, connectedTo: ImmutableArray.Create(2, 4))); - _ = _graph.Add(new Node(id: 4, connectedTo: ImmutableArray.Create(2, 3, 1))); + _ = _graph.Add(new Node(id: 1, connectedTo: [2, 3, 4])); + _ = _graph.Add(new Node(id: 2, connectedTo: [1, 2])); + _ = _graph.Add(new Node(id: 3, connectedTo: [2, 4])); + _ = _graph.Add(new Node(id: 4, connectedTo: [2, 3, 1])); // fast variant via index var fastResult = _graph.Where(x => x.ConnectedTo, contains: 4) diff --git a/Akade.IndexedSet.Tests/Samples/Graph/Node.cs b/Akade.IndexedSet.Tests/Samples/Graph/Node.cs index 239e369..a9836e0 100644 --- a/Akade.IndexedSet.Tests/Samples/Graph/Node.cs +++ b/Akade.IndexedSet.Tests/Samples/Graph/Node.cs @@ -2,14 +2,8 @@ namespace Akade.IndexedSet.Tests.Samples.Graph; -public class Node +public class Node(int id, ImmutableArray connectedTo) { - public Node(int id, ImmutableArray connectedTo) - { - Id = id; - ConnectedTo = connectedTo; - } - - public int Id { get; } - public ImmutableArray ConnectedTo { get; } + public int Id { get; } = id; + public ImmutableArray ConnectedTo { get; } = connectedTo; } diff --git a/Akade.IndexedSet.Tests/Samples/Readme.cs b/Akade.IndexedSet.Tests/Samples/Readme.cs index f00e931..e161e54 100644 --- a/Akade.IndexedSet.Tests/Samples/Readme.cs +++ b/Akade.IndexedSet.Tests/Samples/Readme.cs @@ -54,10 +54,10 @@ public void Features_NonUniqueIndex_MultipleKeys() // \| // 4 - _ = set.Add(new(Id: 1, ConnectsTo: new[] { 3, 4 })); - _ = set.Add(new(Id: 2, ConnectsTo: new[] { 3 })); - _ = set.Add(new(Id: 3, ConnectsTo: new[] { 1, 2, 3 })); - _ = set.Add(new(Id: 4, ConnectsTo: new[] { 1, 3 })); + _ = set.Add(new(Id: 1, ConnectsTo: [3, 4])); + _ = set.Add(new(Id: 2, ConnectsTo: [3])); + _ = set.Add(new(Id: 3, ConnectsTo: [1, 2, 3])); + _ = set.Add(new(Id: 4, ConnectsTo: [1, 3])); // For readability, it is recommended to write the name for the parameter contains IEnumerable nodesThatConnectTo1 = set.Where(x => x.ConnectsTo, contains: 1); // returns nodes 3 & 4 diff --git a/Akade.IndexedSet.Tests/Samples/Search/SearchSamples.cs b/Akade.IndexedSet.Tests/Samples/Search/SearchSamples.cs index ce15d6e..39ccc36 100644 --- a/Akade.IndexedSet.Tests/Samples/Search/SearchSamples.cs +++ b/Akade.IndexedSet.Tests/Samples/Search/SearchSamples.cs @@ -37,7 +37,7 @@ private static int TokenCountMatch(Person x, string[] tokens) public void Search_for_person() { // Combine search results for each token - string[] tokens = Tokenize("John Doe").ToArray(); + string[] tokens = [.. Tokenize("John Doe")]; Person[] searchResult = tokens.SelectMany(x => _set.Contains(SearchIndex, x)) .Distinct() .ToArray(); diff --git a/Akade.IndexedSet.Tests/TestUtilities/IndexAssert.cs b/Akade.IndexedSet.Tests/TestUtilities/IndexAssert.cs index ab62a91..d166e68 100644 --- a/Akade.IndexedSet.Tests/TestUtilities/IndexAssert.cs +++ b/Akade.IndexedSet.Tests/TestUtilities/IndexAssert.cs @@ -1,16 +1,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Runtime.CompilerServices; -#if NET7_0_OR_GREATER -using System.Diagnostics.CodeAnalysis; -#endif namespace Akade.IndexedSet.Tests.TestUtilities; -#if NET7_0_OR_GREATER -[SuppressMessage("Style", "IDE0280:Use 'nameof'", Justification = ".NET 6 is still supported")] -#endif internal static class IndexAssert { - public static void AssertSingleItem(this IndexedSet indexedSet, Func indexAccessor, TElement testData, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public static void AssertSingleItem(this IndexedSet indexedSet, Func indexAccessor, TElement testData, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { Assert.IsNotNull(indexName); @@ -23,7 +17,7 @@ public static void AssertSingleItem(this IndexedSet(this IndexedSet indexedSet, Func> indexAccessor, TElement testData, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public static void AssertSingleItem(this IndexedSet indexedSet, Func> indexAccessor, TElement testData, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { Assert.IsNotNull(indexName); @@ -38,7 +32,7 @@ public static void AssertSingleItem(this IndexedSet(this IndexedSet indexedSet, Func indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null, bool requireOrder = false, params TElement[] expectedElements) + public static void AssertMultipleItems(this IndexedSet indexedSet, Func indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null, bool requireOrder = false, params TElement[] expectedElements) where TIndexKey : notnull { if (expectedElements.Length < 2) @@ -78,7 +72,7 @@ public static void AssertMultipleItemsViaRange TIndexKey end, bool inclusiveStart, bool inclusiveEnd, - [CallerArgumentExpression("indexAccessor")] string? indexName = null, + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null, params TElement[] expectedElements) where TIndexKey : notnull { diff --git a/Akade.IndexedSet.Tests/UniqueIndices.cs b/Akade.IndexedSet.Tests/UniqueIndices.cs index e1320a2..9352428 100644 --- a/Akade.IndexedSet.Tests/UniqueIndices.cs +++ b/Akade.IndexedSet.Tests/UniqueIndices.cs @@ -15,7 +15,7 @@ public class UniqueIndices [TestInitialize] public void Init() { - TestData[] data = new[] { _a, _b, _c }; + TestData[] data = [_a, _b, _c]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithUniqueIndex(x => x.IntProperty) .WithUniqueIndex(x => x.GuidProperty) @@ -50,7 +50,7 @@ public void retrieval_via_secondary_string_key_returns_correct_items() [TestMethod] public void retrieval_via_compound_key_returns_correct_items() { - TestData[] data = new[] { _a, _b, _c }; + TestData[] data = [_a, _b, _c]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithUniqueIndex(x => (x.IntProperty, x.StringProperty)) .Build(); @@ -95,9 +95,9 @@ public void TryGetSingle_on_secondary_key() [TestMethod] public void Retrieval_via_multi_key_retrieves_correct_items() { - static IEnumerable Multikeys(TestData d) => new[] { d.PrimaryKey, d.IntProperty }; + static IEnumerable Multikeys(TestData d) => [d.PrimaryKey, d.IntProperty]; - TestData[] data = new[] { _a, _b, _c }; + TestData[] data = [_a, _b, _c]; _indexedSet = data.ToIndexedSet(x => x.PrimaryKey) .WithUniqueIndex(Multikeys) .Build(); diff --git a/Akade.IndexedSet/Akade.IndexedSet.csproj b/Akade.IndexedSet/Akade.IndexedSet.csproj index bc45b9f..e8de609 100644 --- a/Akade.IndexedSet/Akade.IndexedSet.csproj +++ b/Akade.IndexedSet/Akade.IndexedSet.csproj @@ -1,6 +1,6 @@  - net6.0;net8.0 + net8.0;net9.0 enable enable true @@ -46,8 +46,6 @@ - - diff --git a/Akade.IndexedSet/CompatibilitySuppressions.xml b/Akade.IndexedSet/CompatibilitySuppressions.xml deleted file mode 100644 index 078ef0a..0000000 --- a/Akade.IndexedSet/CompatibilitySuppressions.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - CP0001 - T:Akade.IndexedSet.ExperimentalAttribute - lib/net6.0/Akade.IndexedSet.dll - lib/net8.0/Akade.IndexedSet.dll - - \ No newline at end of file diff --git a/Akade.IndexedSet/Concurrency/ConcurrentIndexedSet.cs b/Akade.IndexedSet/Concurrency/ConcurrentIndexedSet.cs index 4fd97ea..7502ad6 100644 --- a/Akade.IndexedSet/Concurrency/ConcurrentIndexedSet.cs +++ b/Akade.IndexedSet/Concurrency/ConcurrentIndexedSet.cs @@ -9,9 +9,6 @@ namespace Akade.IndexedSet.Concurrency; /// Adds thread-safety, the trade off is, that all reading operations materialize the results into a collection. /// /// -#if NET7_0_OR_GREATER -[SuppressMessage("Style", "IDE0280:Use 'nameof'", Justification = ".NET 6 is still supported")] -#endif public partial class ConcurrentIndexedSet : IDisposable { private readonly ReaderWriterLockEx _lock = new(); @@ -49,7 +46,7 @@ public IEnumerable OrderBy( Func indexAccessor, int skip = 0, int count = -1, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { using (AcquireReaderLock()) @@ -79,7 +76,7 @@ public IEnumerable OrderBy( Func> indexAccessor, int skip = 0, int count = -1, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { using (AcquireReaderLock()) @@ -109,7 +106,7 @@ public IEnumerable OrderByDescending( Func indexAccessor, int skip = 0, int count = -1, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { using (AcquireReaderLock()) @@ -138,7 +135,7 @@ public IEnumerable OrderByDescending( Func> indexAccessor, int skip = 0, int count = -1, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { using (AcquireReaderLock()) diff --git a/Akade.IndexedSet/Concurrency/ReaderWriterLockEx.cs b/Akade.IndexedSet/Concurrency/ReaderWriterLockEx.cs index 0098dd5..48694f0 100644 --- a/Akade.IndexedSet/Concurrency/ReaderWriterLockEx.cs +++ b/Akade.IndexedSet/Concurrency/ReaderWriterLockEx.cs @@ -29,14 +29,9 @@ public IDisposable EnterWriteLock() return _writerDisposable; } - private sealed class ReaderDisposable : IDisposable + private sealed class ReaderDisposable(ReaderWriterLockEx parent) : IDisposable { - private readonly ReaderWriterLockEx _parent; - - public ReaderDisposable(ReaderWriterLockEx parent) - { - _parent = parent; - } + private readonly ReaderWriterLockEx _parent = parent; public void Dispose() { @@ -44,14 +39,9 @@ public void Dispose() } } - private sealed class WriterDisposable : IDisposable + private sealed class WriterDisposable(ReaderWriterLockEx parent) : IDisposable { - private readonly ReaderWriterLockEx _parent; - - public WriterDisposable(ReaderWriterLockEx parent) - { - _parent = parent; - } + private readonly ReaderWriterLockEx _parent = parent; public void Dispose() { diff --git a/Akade.IndexedSet/DataStructures/BinaryHeap.cs b/Akade.IndexedSet/DataStructures/BinaryHeap.cs index bb74a94..27b02f0 100644 --- a/Akade.IndexedSet/DataStructures/BinaryHeap.cs +++ b/Akade.IndexedSet/DataStructures/BinaryHeap.cs @@ -11,7 +11,7 @@ namespace Akade.IndexedSet.DataStructures; /// internal class BinaryHeap : ICollection { - private readonly List _data = new(); + private readonly List _data = []; private readonly Comparer _comparer = Comparer.Default; public int Count => _data.Count; diff --git a/Akade.IndexedSet/DataStructures/Lookup.cs b/Akade.IndexedSet/DataStructures/Lookup.cs index ba30f45..b9648e1 100644 --- a/Akade.IndexedSet/DataStructures/Lookup.cs +++ b/Akade.IndexedSet/DataStructures/Lookup.cs @@ -7,13 +7,13 @@ internal class Lookup where TKey : notnull { - private readonly Dictionary> _values = new(); + private readonly Dictionary> _values = []; public bool Add(TKey key, TValue value) { if (!_values.TryGetValue(key, out HashSet? keySet)) { - keySet = _values[key] = new(); + keySet = _values[key] = []; } if (keySet.Add(value)) diff --git a/Akade.IndexedSet/DataStructures/SortedLookup.cs b/Akade.IndexedSet/DataStructures/SortedLookup.cs index 601553e..b57cb28 100644 --- a/Akade.IndexedSet/DataStructures/SortedLookup.cs +++ b/Akade.IndexedSet/DataStructures/SortedLookup.cs @@ -9,8 +9,8 @@ internal class SortedLookup where TKey : notnull { - private readonly List _sortedValues = new(); - private readonly BinaryHeap _sortedKeys = new(); + private readonly List _sortedValues = []; + private readonly BinaryHeap _sortedKeys = []; public void Add(TKey key, TValue value) { @@ -96,7 +96,7 @@ public IEnumerable GetMaximumValues() { if (_sortedKeys.Count == 0) { - return Enumerable.Empty(); + return []; } Range maximumRange = _sortedKeys.GetRange(GetMaximumKey()); @@ -107,7 +107,7 @@ public IEnumerable GetMinimumValues() { if (_sortedKeys.Count == 0) { - return Enumerable.Empty(); + return []; } Range maximumRange = _sortedKeys.GetRange(GetMinimumKey()); diff --git a/Akade.IndexedSet/DataStructures/Trie.cs b/Akade.IndexedSet/DataStructures/Trie.cs index 33f5764..a98bd21 100644 --- a/Akade.IndexedSet/DataStructures/Trie.cs +++ b/Akade.IndexedSet/DataStructures/Trie.cs @@ -35,10 +35,10 @@ public IEnumerable GetAll(ReadOnlySpan prefix) if (matchingNode is null) { - return Enumerable.Empty(); + return []; } - List result = new(); + List result = []; AddRecursivlyToResult(matchingNode, result); return result; } @@ -171,12 +171,12 @@ internal bool Add(ReadOnlySpan key, TElement element) { if (key.IsEmpty) { - _elements ??= new HashSet(); + _elements ??= []; return _elements.Add(element); } else { - _children ??= new(); + _children ??= []; if (!_children.TryGetValue(key[0], out TrieNode? trieNode)) { _children[key[0]] = trieNode = new(); diff --git a/Akade.IndexedSet/Experiments.cs b/Akade.IndexedSet/Experiments.cs index 3a82e6a..6c25e7e 100644 --- a/Akade.IndexedSet/Experiments.cs +++ b/Akade.IndexedSet/Experiments.cs @@ -1,51 +1,4 @@ -using System.Globalization; - -namespace Akade.IndexedSet; - -#if !NET8_0_OR_GREATER -/// -/// Polyfill for the .NET 8 class. -/// Indicates that an API is experimental and it may change in the future. -/// -[AttributeUsage(AttributeTargets.Assembly | - AttributeTargets.Module | - AttributeTargets.Class | - AttributeTargets.Struct | - AttributeTargets.Enum | - AttributeTargets.Constructor | - AttributeTargets.Method | - AttributeTargets.Property | - AttributeTargets.Field | - AttributeTargets.Event | - AttributeTargets.Interface | - AttributeTargets.Delegate, Inherited = false)] -public class ExperimentalAttribute : Attribute -{ - private readonly string _diagnosticsId; - - /// - /// Initializes a new instance of the class, specifying the ID that the compiler will use - /// when reporting a use of the API the attribute applies to. - /// - internal ExperimentalAttribute(string diagnosticsId) - { - _diagnosticsId = diagnosticsId; - } - - /// - public override string ToString() - { - return UrlFormat is null ? _diagnosticsId : string.Format(CultureInfo.InvariantCulture, UrlFormat, _diagnosticsId); - } - - /// - /// Gets or sets the URL for corresponding documentation. - /// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID. - /// - public string? UrlFormat { get; set; } -} - -#endif +namespace Akade.IndexedSet; internal static class Experiments { diff --git a/Akade.IndexedSet/IndexedSet.cs b/Akade.IndexedSet/IndexedSet.cs index be9a91a..ad55130 100644 --- a/Akade.IndexedSet/IndexedSet.cs +++ b/Akade.IndexedSet/IndexedSet.cs @@ -2,9 +2,7 @@ using Akade.IndexedSet.Concurrency; using Akade.IndexedSet.Indices; -#if NET8_0_OR_GREATER using System.Collections.Frozen; -#endif using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -15,19 +13,12 @@ namespace Akade.IndexedSet; /// create an instance. The set is not thread-safe. /// [SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used as caller argument expression")] -#if NET7_0_OR_GREATER -[SuppressMessage("Style", "IDE0280:Use 'nameof'", Justification = ".NET 6 is still supported")] -#endif public class IndexedSet { - private readonly HashSet _data = new(); -#if NET8_0_OR_GREATER + private readonly HashSet _data = []; private FrozenDictionary> _indices = FrozenDictionary>.Empty; private FrozenDictionary> _indexWriters = FrozenDictionary>.Empty; -#else - private readonly Dictionary> _indices = new(); - private readonly Dictionary> _indexWriters = new(); -#endif + /// /// Creates a new, empty instance of an . /// @@ -89,7 +80,7 @@ public int AddRange(IEnumerable elements) } else { - elementsToAdd = new(); + elementsToAdd = []; } foreach (TElement element in elements) @@ -153,7 +144,7 @@ public bool TryGetSingle( Func indexAccessor, TIndexKey indexKey, [NotNullWhen(true)] out TElement? element, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -174,7 +165,7 @@ public bool TryGetSingle( Func> indexAccessor, TIndexKey indexKey, [NotNullWhen(true)] out TElement? element, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -193,7 +184,7 @@ public bool TryGetSingle( public TElement Single( Func indexAccessor, TIndexKey indexKey, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -212,7 +203,7 @@ public TElement Single( public TElement Single( Func> indexAccessor, TIndexKey contains, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -231,7 +222,7 @@ public TElement Single( public IEnumerable Where( Func indexAccessor, TIndexKey indexKey, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -250,7 +241,7 @@ public IEnumerable Where( public IEnumerable Where( Func> indexAccessor, TIndexKey contains, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -276,7 +267,7 @@ public IEnumerable Range( TIndexKey end, bool inclusiveStart = true, bool inclusiveEnd = false, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -302,7 +293,7 @@ public IEnumerable Range( TIndexKey end, bool inclusiveStart = true, bool inclusiveEnd = false, - [CallerArgumentExpression("indexAccessor")] string? indexName = null) + [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -318,7 +309,7 @@ public IEnumerable Range( /// The key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable LessThan(Func indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable LessThan(Func indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -334,7 +325,7 @@ public IEnumerable LessThan(Func index /// The key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable LessThan(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable LessThan(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -350,7 +341,7 @@ public IEnumerable LessThan(FuncThe key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable LessThanOrEqual(Func indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable LessThanOrEqual(Func indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -366,7 +357,7 @@ public IEnumerable LessThanOrEqual(FuncThe key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable LessThanOrEqual(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable LessThanOrEqual(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -382,7 +373,7 @@ public IEnumerable LessThanOrEqual(FuncThe key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable GreaterThan(Func indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable GreaterThan(Func indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -398,7 +389,7 @@ public IEnumerable GreaterThan(Func in /// The key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable GreaterThan(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable GreaterThan(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -414,7 +405,7 @@ public IEnumerable GreaterThan(FuncThe key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable GreaterThanOrEqual(Func indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable GreaterThanOrEqual(Func indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -430,7 +421,7 @@ public IEnumerable GreaterThanOrEqual(FuncThe key value to compare other keys with. /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable GreaterThanOrEqual(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable GreaterThanOrEqual(Func> indexAccessor, TIndexKey value, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -445,7 +436,7 @@ public IEnumerable GreaterThanOrEqual(Func using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public TIndexKey Max(Func indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public TIndexKey Max(Func indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -460,7 +451,7 @@ public TIndexKey Max(Func indexAccessor, [Caller /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public TIndexKey Max(Func> indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public TIndexKey Max(Func> indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -475,7 +466,7 @@ public TIndexKey Max(Func> indexAcce /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public TIndexKey Min(Func indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public TIndexKey Min(Func indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -490,7 +481,7 @@ public TIndexKey Min(Func indexAccessor, [Caller /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public TIndexKey Min(Func> indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public TIndexKey Min(Func> indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -505,7 +496,7 @@ public TIndexKey Min(Func> indexAcce /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable MaxBy(Func indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable MaxBy(Func indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -520,7 +511,7 @@ public IEnumerable MaxBy(Func indexAcc /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable MaxBy(Func> indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable MaxBy(Func> indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -535,7 +526,7 @@ public IEnumerable MaxBy(Func using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable MinBy(Func indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable MinBy(Func indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -550,7 +541,7 @@ public IEnumerable MinBy(Func indexAcc /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable MinBy(Func> indexAccessor, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable MinBy(Func> indexAccessor, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -565,7 +556,7 @@ public IEnumerable MinBy(Func using . /// Allows to efficiently skip a number of elements. Default is 0 /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. - public IEnumerable OrderBy(Func indexAccessor, int skip = 0, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable OrderBy(Func indexAccessor, int skip = 0, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -580,7 +571,7 @@ public IEnumerable OrderBy(Func indexA /// Is passed to using . /// Allows to efficiently skip a number of elements. Default is 0 /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. - public IEnumerable OrderBy(Func> indexAccessor, int skip = 0, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable OrderBy(Func> indexAccessor, int skip = 0, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -595,7 +586,7 @@ public IEnumerable OrderBy(FuncAccessor for the indexed property. The expression as a string is used as an identifier for the index. Hence, the convention is to always use x as an identifier. /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. - public IEnumerable OrderByDescending(Func indexAccessor, int skip = 0, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable OrderByDescending(Func indexAccessor, int skip = 0, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -610,7 +601,7 @@ public IEnumerable OrderByDescending(FuncAccessor for the indexed property. The expression as a string is used as an identifier for the index. Hence, the convention is to always use x as an identifier. /// Is passed to using . /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. - public IEnumerable OrderByDescending(Func> indexAccessor, int skip = 0, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable OrderByDescending(Func> indexAccessor, int skip = 0, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) where TIndexKey : notnull { TypedIndex typedIndex = GetIndex(indexName); @@ -625,7 +616,7 @@ public IEnumerable OrderByDescending(FuncThe prefix to use /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable StartsWith(Func indexAccessor, ReadOnlySpan prefix, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable StartsWith(Func indexAccessor, ReadOnlySpan prefix, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.StartsWith(prefix); @@ -640,7 +631,7 @@ public IEnumerable StartsWith(Func indexAccessor, Re /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] [Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)] - public IEnumerable StartsWith(Func> indexAccessor, ReadOnlySpan prefix, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable StartsWith(Func> indexAccessor, ReadOnlySpan prefix, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.StartsWith(prefix); @@ -655,7 +646,7 @@ public IEnumerable StartsWith(Func> inde /// The maximum distance (e.g. Levenshtein) between the input prefix and matches /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable FuzzyStartsWith(Func indexAccessor, ReadOnlySpan prefix, int maxDistance, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable FuzzyStartsWith(Func indexAccessor, ReadOnlySpan prefix, int maxDistance, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.FuzzyStartsWith(prefix, maxDistance); @@ -671,7 +662,7 @@ public IEnumerable FuzzyStartsWith(Func indexAccesso /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] [Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)] - public IEnumerable FuzzyStartsWith(Func> indexAccessor, ReadOnlySpan prefix, int maxDistance, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable FuzzyStartsWith(Func> indexAccessor, ReadOnlySpan prefix, int maxDistance, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.FuzzyStartsWith(prefix, maxDistance); @@ -685,7 +676,7 @@ public IEnumerable FuzzyStartsWith(Func> /// The infix to use /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable Contains(Func indexAccessor, ReadOnlySpan infix, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable Contains(Func indexAccessor, ReadOnlySpan infix, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.Contains(infix); @@ -700,7 +691,7 @@ public IEnumerable Contains(Func indexAccessor, Read /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] [Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)] - public IEnumerable Contains(Func> indexAccessor, ReadOnlySpan infix, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable Contains(Func> indexAccessor, ReadOnlySpan infix, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.Contains(infix); @@ -715,7 +706,7 @@ public IEnumerable Contains(Func> indexA /// The maximum distance (e.g. Levenshtein) between the input infix and matches /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] - public IEnumerable FuzzyContains(Func indexAccessor, ReadOnlySpan infix, int maxDistance, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable FuzzyContains(Func indexAccessor, ReadOnlySpan infix, int maxDistance, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.FuzzyContains(infix, maxDistance); @@ -731,7 +722,7 @@ public IEnumerable FuzzyContains(Func indexAccessor, /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. [ReadAccess] [Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)] - public IEnumerable FuzzyContains(Func> indexAccessor, ReadOnlySpan infix, int maxDistance, [CallerArgumentExpression("indexAccessor")] string? indexName = null) + public IEnumerable FuzzyContains(Func> indexAccessor, ReadOnlySpan infix, int maxDistance, [CallerArgumentExpression(nameof(indexAccessor))] string? indexName = null) { TypedIndex typedIndex = GetIndex(indexName); return typedIndex.FuzzyContains(infix, maxDistance); @@ -860,14 +851,8 @@ internal void AddIndex(IndexWriter writer, Index index) { ThrowIfNonEmpty(); -#if NET8_0_OR_GREATER _indices = _indices.Append(new KeyValuePair>(index.Name, index)).ToFrozenDictionary(); _indexWriters = _indexWriters.Append(new KeyValuePair>(index.Name, writer)).ToFrozenDictionary(); -#else - _indices.Add(index.Name, index); - _indexWriters.Add(index.Name, writer); - -#endif } private void ThrowIfNonEmpty() @@ -883,9 +868,6 @@ private void ThrowIfNonEmpty() /// Additionally provides convenience access to a "primary key" unique index. /// Functionally the same as manually adding a unique index on the primary key property. /// -#if NET7_0_OR_GREATER -[SuppressMessage("Style", "IDE0280:Use 'nameof'", Justification = ".NET 6 is still supported")] -#endif public class IndexedSet : IndexedSet where TPrimaryKey : notnull { @@ -898,7 +880,7 @@ public class IndexedSet : IndexedSet /// Returns the primary key for a given item. The primary key should not be changed while the element is within the set. The expression as a string is used as an identifier for the index. Hence, the convention is to always use x as an identifier. /// Is passed to using . /// The name for the primary index. Usually, you should not specify this as the expression in is automatically passed by the compiler. - protected internal IndexedSet(Func primaryKeyAccessor, [CallerArgumentExpression("primaryKeyAccessor")] string primaryKeyIndexName = "") + protected internal IndexedSet(Func primaryKeyAccessor, [CallerArgumentExpression(nameof(primaryKeyAccessor))] string primaryKeyIndexName = "") { _primaryKeyAccessor = primaryKeyAccessor; _primaryKeyIndexName = primaryKeyIndexName; diff --git a/Akade.IndexedSet/IndexedSetBuilder.cs b/Akade.IndexedSet/IndexedSetBuilder.cs index 9b0e3dc..91d5e48 100644 --- a/Akade.IndexedSet/IndexedSetBuilder.cs +++ b/Akade.IndexedSet/IndexedSetBuilder.cs @@ -10,9 +10,6 @@ namespace Akade.IndexedSet; /// /// Helper class to support type inference for element and primary key type for /// -#if NET7_0_OR_GREATER -[SuppressMessage("Style", "IDE0280:Use 'nameof'", Justification = ".NET 6 is still supported")] -#endif public static class IndexedSetBuilder { /// @@ -21,7 +18,7 @@ public static class IndexedSetBuilder public static IndexedSetBuilder Create( IEnumerable initialContent, Func primaryKeyAccessor, - [CallerArgumentExpression("primaryKeyAccessor")] string primaryKeyIndexName = "") + [CallerArgumentExpression(nameof(primaryKeyAccessor))] string primaryKeyIndexName = "") where TPrimaryKey : notnull { return new IndexedSetBuilder(primaryKeyAccessor, initialContent, primaryKeyIndexName); @@ -33,7 +30,7 @@ public static IndexedSetBuilder Create ToIndexedSet( this IEnumerable initialContent, Func primaryKeyAccessor, - [CallerArgumentExpression("primaryKeyAccessor")] string primaryKeyIndexName = "") + [CallerArgumentExpression(nameof(primaryKeyAccessor))] string primaryKeyIndexName = "") where TPrimaryKey : notnull { return new IndexedSetBuilder(primaryKeyAccessor, initialContent, primaryKeyIndexName); @@ -59,9 +56,6 @@ public static IndexedSetBuilder ToIndexedSet(this IEnumerabl /// /// Helper class to support type inference for the primary key type for /// -#if NET7_0_OR_GREATER -[SuppressMessage("Style", "IDE0280:Use 'nameof'", Justification = ".NET 6 is still supported")] -#endif public class IndexedSetBuilder { private readonly IndexedSet _result; @@ -72,7 +66,7 @@ public class IndexedSetBuilder /// Use if you /// want to include initial content /// - public static IndexedSetBuilder Create(Func primaryKeyAccessor, [CallerArgumentExpression("primaryKeyAccessor")] string primaryKeyIndexName = "") + public static IndexedSetBuilder Create(Func primaryKeyAccessor, [CallerArgumentExpression(nameof(primaryKeyAccessor))] string primaryKeyIndexName = "") where TPrimaryKey : notnull { return new IndexedSetBuilder(primaryKeyAccessor, null, primaryKeyIndexName); @@ -106,7 +100,7 @@ internal IndexedSetBuilder(IndexedSet? indexedSet, IEnumerable /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithUniqueIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithUniqueIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) where TIndexKey : notnull { ArgumentNullException.ThrowIfNull(indexName); @@ -128,7 +122,7 @@ public virtual IndexedSetBuilder WithUniqueIndex(Func /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithUniqueIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithUniqueIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) where TIndexKey : notnull { ArgumentNullException.ThrowIfNull(indexName); @@ -150,7 +144,7 @@ public virtual IndexedSetBuilder WithUniqueIndex(Func /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) where TIndexKey : notnull { ArgumentNullException.ThrowIfNull(indexName); @@ -172,7 +166,7 @@ public virtual IndexedSetBuilder WithIndex(Func /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) where TIndexKey : notnull { ArgumentNullException.ThrowIfNull(indexName); @@ -194,7 +188,7 @@ public virtual IndexedSetBuilder WithIndex(Func /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithRangeIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithRangeIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) where TIndexKey : notnull { ArgumentNullException.ThrowIfNull(indexName); @@ -216,7 +210,7 @@ public virtual IndexedSetBuilder WithRangeIndex(Func /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithRangeIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithRangeIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) where TIndexKey : notnull { ArgumentNullException.ThrowIfNull(indexName); @@ -237,7 +231,7 @@ public virtual IndexedSetBuilder WithRangeIndex(Func /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithFullTextIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithFullTextIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { ArgumentNullException.ThrowIfNull(indexName); @@ -258,7 +252,7 @@ public virtual IndexedSetBuilder WithFullTextIndex(FuncThe name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. [Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)] - public virtual IndexedSetBuilder WithFullTextIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithFullTextIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { ArgumentNullException.ThrowIfNull(indexName); @@ -278,7 +272,7 @@ public virtual IndexedSetBuilder WithFullTextIndex(Func /// The name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. - public virtual IndexedSetBuilder WithPrefixIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithPrefixIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { ArgumentNullException.ThrowIfNull(indexName); @@ -299,7 +293,7 @@ public virtual IndexedSetBuilder WithPrefixIndex(FuncThe name of the index. Usually, you should not specify this as the expression in is automatically passed by the compiler. /// The instance on which this method is called is returned to support the fluent syntax. [Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)] - public virtual IndexedSetBuilder WithPrefixIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public virtual IndexedSetBuilder WithPrefixIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { ArgumentNullException.ThrowIfNull(indexName); @@ -334,9 +328,6 @@ public virtual ConcurrentIndexedSet BuildConcurrent() /// Helper class to create with a fluent syntax. /// Use and to obtain a builder. /// -#if NET7_0_OR_GREATER -[SuppressMessage("Style", "IDE0280:Use 'nameof'", Justification = ".NET 6 is still supported")] -#endif public class IndexedSetBuilder : IndexedSetBuilder where TPrimaryKey : notnull { @@ -346,42 +337,42 @@ internal IndexedSetBuilder(Func primaryKeyAccessor, IEnum } /// - public override IndexedSetBuilder WithIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithIndex(keyAccessor, indexName); return this; } /// - public override IndexedSetBuilder WithIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithIndex(keyAccessor, indexName); return this; } /// - public override IndexedSetBuilder WithRangeIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithRangeIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithRangeIndex(keyAccessor, indexName); return this; } /// - public override IndexedSetBuilder WithRangeIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithRangeIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithRangeIndex(keyAccessor, indexName); return this; } /// - public override IndexedSetBuilder WithUniqueIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithUniqueIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithUniqueIndex(keyAccessor, indexName); return this; } /// - public override IndexedSetBuilder WithUniqueIndex(Func> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithUniqueIndex(Func> keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithUniqueIndex(keyAccessor, indexName); return this; @@ -389,14 +380,14 @@ public override IndexedSetBuilder WithUniqueIndex - public override IndexedSetBuilder WithFullTextIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithFullTextIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithFullTextIndex(keyAccessor, indexName); return this; } /// - public override IndexedSetBuilder WithPrefixIndex(Func keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null) + public override IndexedSetBuilder WithPrefixIndex(Func keyAccessor, [CallerArgumentExpression(nameof(keyAccessor))] string? indexName = null) { _ = base.WithPrefixIndex(keyAccessor, indexName); return this; diff --git a/Akade.IndexedSet/Indices/FullTextIndex.cs b/Akade.IndexedSet/Indices/FullTextIndex.cs index f58bc04..bc5b098 100644 --- a/Akade.IndexedSet/Indices/FullTextIndex.cs +++ b/Akade.IndexedSet/Indices/FullTextIndex.cs @@ -86,7 +86,7 @@ internal override IEnumerable Where(string indexKey) internal override IEnumerable StartsWith(ReadOnlySpan indexKey) { - HashSet matches = new(); + HashSet matches = []; foreach (TElement candidate in _suffixTrie.GetAll(indexKey)) { @@ -106,7 +106,7 @@ private static bool VerifyFuzzyStartsWith(ReadOnlySpan found, ReadOnlySpa internal override IEnumerable FuzzyStartsWith(ReadOnlySpan indexKey, int maxDistance) { - HashSet matches = new(); + HashSet matches = []; foreach (TElement candidate in _suffixTrie.FuzzySearch(indexKey, maxDistance, false)) { diff --git a/Akade.IndexedSet/Indices/Index.cs b/Akade.IndexedSet/Indices/Index.cs index 53e8e9c..1bc90fe 100644 --- a/Akade.IndexedSet/Indices/Index.cs +++ b/Akade.IndexedSet/Indices/Index.cs @@ -3,14 +3,9 @@ /// /// Non-generic on the index key to have a strongly typed base class for an index /// -internal abstract class Index +internal abstract class Index(string name) { - public string Name { get; } - - protected Index(string name) - { - Name = name; - } + public string Name { get; } = name; public abstract void Clear(); } \ No newline at end of file diff --git a/Akade.IndexedSet/Indices/IndexWriter.cs b/Akade.IndexedSet/Indices/IndexWriter.cs index 7620b5e..65eb828 100644 --- a/Akade.IndexedSet/Indices/IndexWriter.cs +++ b/Akade.IndexedSet/Indices/IndexWriter.cs @@ -17,18 +17,12 @@ internal abstract class TypedIndexWriter : IndexWri } -internal sealed class SingleKeyIndexWriter : TypedIndexWriter +internal sealed class SingleKeyIndexWriter(Func keyAccessor, TIndex index) : TypedIndexWriter where TIndexKey : notnull where TIndex : TypedIndex { - private readonly Func _keyAccessor; - private readonly TIndex _index; - - public SingleKeyIndexWriter(Func keyAccessor, TIndex index) - { - _keyAccessor = keyAccessor; - _index = index; - } + private readonly Func _keyAccessor = keyAccessor; + private readonly TIndex _index = index; internal override void Add(TElement element) { @@ -46,18 +40,12 @@ internal override void Remove(TElement element) } } -internal sealed class MultiKeyIndexWriter : TypedIndexWriter +internal sealed class MultiKeyIndexWriter(Func> keyAccessor, TIndex index) : TypedIndexWriter where TIndexKey : notnull where TIndex : TypedIndex { - private readonly Func> _keyAccessor; - private readonly TIndex _index; - - public MultiKeyIndexWriter(Func> keyAccessor, TIndex index) - { - _keyAccessor = keyAccessor; - _index = index; - } + private readonly Func> _keyAccessor = keyAccessor; + private readonly TIndex _index = index; internal override void Add(TElement element) { diff --git a/Akade.IndexedSet/Indices/MultiRangeIndex.cs b/Akade.IndexedSet/Indices/MultiRangeIndex.cs index 54fa5bb..25a7342 100644 --- a/Akade.IndexedSet/Indices/MultiRangeIndex.cs +++ b/Akade.IndexedSet/Indices/MultiRangeIndex.cs @@ -7,15 +7,10 @@ namespace Akade.IndexedSet.Indices; /// O(log(n)) range queries based on . Filters for distinct values as it is used /// for indices where elements can have multiple keys. /// -internal class MultiRangeIndex : TypedIndex +internal class MultiRangeIndex(string name) : TypedIndex(name) where TIndexKey : notnull { - private readonly SortedLookup _lookup; - - public MultiRangeIndex(string name) : base(name) - { - _lookup = new(); - } + private readonly SortedLookup _lookup = new(); internal override void Add(TIndexKey key, TElement value) { @@ -76,13 +71,13 @@ internal override IEnumerable GreaterThan(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey maxKey = _lookup.GetMaximumKey(); return Comparer.Default.Compare(value, maxKey) >= 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(value, maxKey, false, true).Distinct(); } @@ -90,13 +85,13 @@ internal override IEnumerable GreaterThanOrEqual(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey maxKey = _lookup.GetMaximumKey(); return Comparer.Default.Compare(value, maxKey) > 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(value, maxKey, true, true).Distinct(); } @@ -104,13 +99,13 @@ internal override IEnumerable LessThan(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey minKey = _lookup.GetMinimumKey(); return Comparer.Default.Compare(value, minKey) <= 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(minKey, value, true, false).Distinct(); } @@ -118,13 +113,13 @@ internal override IEnumerable LessThanOrEqual(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey? minKey = _lookup.GetMinimumKey(); return Comparer.Default.Compare(value, minKey) < 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(minKey, value, true, true).Distinct(); } diff --git a/Akade.IndexedSet/Indices/NonUniqueIndex.cs b/Akade.IndexedSet/Indices/NonUniqueIndex.cs index 6cdb90c..f871d13 100644 --- a/Akade.IndexedSet/Indices/NonUniqueIndex.cs +++ b/Akade.IndexedSet/Indices/NonUniqueIndex.cs @@ -3,15 +3,11 @@ /// /// Nonunique index implementation based on /// -internal sealed class NonUniqueIndex : TypedIndex +internal sealed class NonUniqueIndex(string name) : TypedIndex(name) where TIndexKey : notnull { private readonly DataStructures.Lookup _data = new(); - public NonUniqueIndex(string name) : base(name) - { - } - internal override void Add(TIndexKey key, TElement value) { _ = _data.Add(key, value); diff --git a/Akade.IndexedSet/Indices/PrefixIndex.cs b/Akade.IndexedSet/Indices/PrefixIndex.cs index 2f7aec1..f715e6b 100644 --- a/Akade.IndexedSet/Indices/PrefixIndex.cs +++ b/Akade.IndexedSet/Indices/PrefixIndex.cs @@ -2,14 +2,9 @@ using Akade.IndexedSet.Extensions; namespace Akade.IndexedSet.Indices; -internal class PrefixIndex : TypedIndex +internal class PrefixIndex(string name) : TypedIndex(name) { - private readonly Trie _trie; - - public PrefixIndex(string name) : base(name) - { - _trie = new(); - } + private readonly Trie _trie = new(); internal override void Add(string key, TElement value) { diff --git a/Akade.IndexedSet/Indices/RangeIndex.cs b/Akade.IndexedSet/Indices/RangeIndex.cs index b511442..a51a89e 100644 --- a/Akade.IndexedSet/Indices/RangeIndex.cs +++ b/Akade.IndexedSet/Indices/RangeIndex.cs @@ -5,15 +5,10 @@ namespace Akade.IndexedSet.Indices; /// /// O(log(n)) range queries based on . /// -internal class RangeIndex : TypedIndex +internal class RangeIndex(string name) : TypedIndex(name) where TIndexKey : notnull { - private readonly SortedLookup _lookup; - - public RangeIndex(string name) : base(name) - { - _lookup = new(); - } + private readonly SortedLookup _lookup = new(); internal override void Add(TIndexKey key, TElement value) { @@ -62,13 +57,13 @@ internal override IEnumerable GreaterThan(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey maxKey = _lookup.GetMaximumKey(); return Comparer.Default.Compare(value, maxKey) >= 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(value, maxKey, false, true); } @@ -76,13 +71,13 @@ internal override IEnumerable GreaterThanOrEqual(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey maxKey = _lookup.GetMaximumKey(); return Comparer.Default.Compare(value, maxKey) > 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(value, maxKey, true, true); } @@ -90,13 +85,13 @@ internal override IEnumerable LessThan(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey minKey = _lookup.GetMinimumKey(); return Comparer.Default.Compare(value, minKey) <= 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(minKey, value, true, false); } @@ -104,13 +99,13 @@ internal override IEnumerable LessThanOrEqual(TIndexKey value) { if (_lookup.Count == 0) { - return Enumerable.Empty(); + return []; } TIndexKey? minKey = _lookup.GetMinimumKey(); return Comparer.Default.Compare(value, minKey) < 0 - ? Enumerable.Empty() + ? [] : _lookup.GetValuesInRange(minKey, value, true, true); } diff --git a/Akade.IndexedSet/Indices/TypedIndex.cs b/Akade.IndexedSet/Indices/TypedIndex.cs index efcbd22..dbcd32b 100644 --- a/Akade.IndexedSet/Indices/TypedIndex.cs +++ b/Akade.IndexedSet/Indices/TypedIndex.cs @@ -3,26 +3,20 @@ /// /// Fully-generic index including on the index key /// -internal abstract class TypedIndex : Index +internal abstract class TypedIndex(string name) : Index(name) where TIndexKey : notnull { - protected TypedIndex(string name) : base(name) - { - - } - internal abstract void Add(TIndexKey key, TElement value); internal abstract void Remove(TIndexKey key, TElement value); - + internal virtual void AddRange(IEnumerable> enumerable) { - foreach(KeyValuePair kvp in enumerable) + foreach (KeyValuePair kvp in enumerable) { Add(kvp.Key, kvp.Value); } } - internal abstract TElement Single(TIndexKey indexKey); internal abstract bool TryGetSingle(TIndexKey indexKey, out TElement? element); diff --git a/Akade.IndexedSet/Indices/UniqueIndex.cs b/Akade.IndexedSet/Indices/UniqueIndex.cs index 5a76018..9d84c14 100644 --- a/Akade.IndexedSet/Indices/UniqueIndex.cs +++ b/Akade.IndexedSet/Indices/UniqueIndex.cs @@ -3,14 +3,10 @@ /// /// Unique index providing O(1) retrieval and insertion as well as enforcing unqueness /// -internal class UniqueIndex : TypedIndex +internal class UniqueIndex(string name) : TypedIndex(name) where TIndexKey : notnull { - private readonly Dictionary _data = new(); - - public UniqueIndex(string name) : base(name) - { - } + private readonly Dictionary _data = []; internal override void Add(TIndexKey key, TElement value) { @@ -56,6 +52,6 @@ internal override bool TryGetSingle(TIndexKey indexKey, out TElement? element) internal override IEnumerable Where(TIndexKey indexKey) { - return _data.TryGetValue(indexKey, out TElement? result) ? new[] { result } : Enumerable.Empty(); + return _data.TryGetValue(indexKey, out TElement? result) ? [result] : []; } } diff --git a/Akade.IndexedSet/PublicAPI/net6.0/PublicAPI.Shipped.txt b/Akade.IndexedSet/PublicAPI/net6.0/PublicAPI.Shipped.txt deleted file mode 100644 index b4cf8e3..0000000 --- a/Akade.IndexedSet/PublicAPI/net6.0/PublicAPI.Shipped.txt +++ /dev/null @@ -1,4 +0,0 @@ -Akade.IndexedSet.ExperimentalAttribute -Akade.IndexedSet.ExperimentalAttribute.UrlFormat.get -> string? -Akade.IndexedSet.ExperimentalAttribute.UrlFormat.set -> void -override Akade.IndexedSet.ExperimentalAttribute.ToString() -> string! diff --git a/Akade.IndexedSet/PublicAPI/net6.0/PublicAPI.Unshipped.txt b/Akade.IndexedSet/PublicAPI/net6.0/PublicAPI.Unshipped.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Akade.IndexedSet/PublicAPI/net8.0/PublicAPI.Shipped.txt b/Akade.IndexedSet/PublicAPI/net8.0/PublicAPI.Shipped.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Akade.IndexedSet/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/Akade.IndexedSet/PublicAPI/net8.0/PublicAPI.Unshipped.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj index 6d33aa9..2f4e927 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 true true @@ -12,12 +12,12 @@ - - - - - - + + + + + + diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/ReadMethodDoesNotContainWriteMethodAccess.cs b/Analyzers/Akade.IndexedSet.Analyzers.Test/ReadMethodDoesNotContainWriteMethodAccess.cs index 4bd2fe8..9644531 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/ReadMethodDoesNotContainWriteMethodAccess.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/ReadMethodDoesNotContainWriteMethodAccess.cs @@ -1,7 +1,6 @@ using Microsoft.CodeAnalysis.Testing; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Threading.Tasks; -using System.Xml.Linq; using VerifyCS = Akade.IndexedSet.Analyzers.Test.CSharpAnalyzerVerifier; namespace Akade.IndexedSet.Analyzers.Test; diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/SampleCodeGenerator.cs b/Analyzers/Akade.IndexedSet.Analyzers.Test/SampleCodeGenerator.cs index e064b13..ce6dab4 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/SampleCodeGenerator.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/SampleCodeGenerator.cs @@ -8,53 +8,53 @@ namespace Akade.IndexedSet.Analyzers.Test; internal static class SampleCodeGenerator { private static readonly string[] _setTypes = - { + [ "IndexedSet", "IndexedSet", "ConcurrentIndexedSet", "ConcurrentIndexedSet" - }; + ]; private static readonly string[] _setIncorrectMethods = - { + [ "Single({|#0:a => a|}, 1)", "Where({|#0:(x) => x|}, 2)", "StartsWith({|#0:x => { return x.ToString().ToLowerInvariant(); }|}, \"Test\")", - }; + ]; private static readonly string[] _setFixedMethods = - { + [ "Single(x => x, 1)", "Where(x => x, 2)", "StartsWith(x => x.ToString().ToLowerInvariant(), \"Test\")", - }; + ]; private static readonly string[] _builderIncorrectMethods = - { + [ "WithIndex({|#0:a => a|})", "WithRangeIndex({|#0:(x) => x|})", "WithFullTextIndex({|#0:x => { return x.ToString().ToLowerInvariant(); }|})", - }; + ]; private static readonly string[] _builderFixedMethods = - { + [ "WithIndex(x => x)", "WithRangeIndex(x => x)", "WithFullTextIndex(x => x.ToString().ToLowerInvariant())", - }; + ]; private static readonly string[] _builderTypes = - { + [ "ToIndexedSet()", "ToIndexedSet(x => x)" - }; + ]; private static readonly DiagnosticResult[] _diagnosticIds = - { + [ VerifyCS.Diagnostic(IndexNamingRulesAnalyzer.UseXAsIdentifierInLambdaRuleId).WithLocation(0).WithArguments("a"), VerifyCS.Diagnostic(IndexNamingRulesAnalyzer.DoNotUseParenthesesInLambdaRuleId).WithLocation(0), VerifyCS.Diagnostic(IndexNamingRulesAnalyzer.DoNotUseBlockBodiedLambdaRuleId).WithLocation(0), - }; + ]; public static IEnumerable<(string incorrectCode, DiagnosticResult diagnostic, string fixedCode)> GetAllSamples() { diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier+Test.cs b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier+Test.cs index fe07113..46ad4a9 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier+Test.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier+Test.cs @@ -4,9 +4,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; -using System; -using System.Collections.Immutable; using System.Diagnostics; using System.IO; @@ -15,14 +12,14 @@ namespace Akade.IndexedSet.Analyzers.Test; public static partial class CSharpAnalyzerVerifier where TAnalyzer : DiagnosticAnalyzer, new() { - public class Test : CSharpAnalyzerTest + public class Test : CSharpAnalyzerTest { public Test() { string config = "Release"; SetVersion(ref config); - ReferenceAssemblies = new ReferenceAssemblies("net8.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "8.0.0"), Path.Combine("ref", "net8.0")); + ReferenceAssemblies = ReferenceAssemblies.Net.Net90; TestState.AdditionalReferences.Add(typeof(IndexedSet<>).Assembly); diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier.cs b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier.cs index 4679823..4bd764f 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpAnalyzerVerifier.cs @@ -1,9 +1,7 @@ using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using System.Threading; using System.Threading.Tasks; @@ -15,19 +13,19 @@ public static partial class CSharpAnalyzerVerifier /// public static DiagnosticResult Diagnostic() { - return CSharpAnalyzerVerifier.Diagnostic(); + return CSharpAnalyzerVerifier.Diagnostic(); } /// public static DiagnosticResult Diagnostic(string diagnosticId) { - return CSharpAnalyzerVerifier.Diagnostic(diagnosticId); + return CSharpAnalyzerVerifier.Diagnostic(diagnosticId); } /// public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor) { - return CSharpAnalyzerVerifier.Diagnostic(descriptor); + return CSharpAnalyzerVerifier.Diagnostic(descriptor); } /// diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2+Test.cs b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2+Test.cs index 867fa60..4eeae32 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2+Test.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2+Test.cs @@ -5,9 +5,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; -using System; -using System.Collections.Immutable; using System.Diagnostics; using System.IO; @@ -17,14 +14,14 @@ public static partial class CSharpCodeFixVerifier where TAnalyzer : DiagnosticAnalyzer, new() where TCodeFix : CodeFixProvider, new() { - public class Test : CSharpCodeFixTest + public class Test : CSharpCodeFixTest { public Test() { string config = "Release"; SetVersion(ref config); - ReferenceAssemblies = new ReferenceAssemblies("net8.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "8.0.0"), Path.Combine("ref", "net8.0")); + ReferenceAssemblies = ReferenceAssemblies = ReferenceAssemblies.Net.Net90; TestState.AdditionalReferences.Add(typeof(IndexedSet<>).Assembly); diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2.cs b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2.cs index b1c629a..c2cc9de 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpCodeFixVerifier`2.cs @@ -3,7 +3,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using System.Threading; using System.Threading.Tasks; @@ -16,19 +15,19 @@ public static partial class CSharpCodeFixVerifier /// public static DiagnosticResult Diagnostic() { - return CSharpCodeFixVerifier.Diagnostic(); + return CSharpCodeFixVerifier.Diagnostic(); } /// public static DiagnosticResult Diagnostic(string diagnosticId) { - return CSharpCodeFixVerifier.Diagnostic(diagnosticId); + return CSharpCodeFixVerifier.Diagnostic(diagnosticId); } /// public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor) { - return CSharpCodeFixVerifier.Diagnostic(descriptor); + return CSharpCodeFixVerifier.Diagnostic(descriptor); } /// @@ -52,7 +51,7 @@ public static async Task VerifyCodeFixAsync(string source, string fixedSource) /// public static async Task VerifyCodeFixAsync(string source, DiagnosticResult expected, string fixedSource) { - await VerifyCodeFixAsync(source, new[] { expected }, fixedSource); + await VerifyCodeFixAsync(source, [expected], fixedSource); } /// diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpVerifierHelper.cs b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpVerifierHelper.cs index 0c132bd..dc5ed0e 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpVerifierHelper.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Verifiers/CSharpVerifierHelper.cs @@ -18,7 +18,7 @@ internal static class CSharpVerifierHelper private static ImmutableDictionary GetNullableWarningsFromCompiler() { - string[] args = { "/warnaserror:nullable" }; + string[] args = ["/warnaserror:nullable"]; CSharpCommandLineArguments commandLineArguments = CSharpCommandLineParser.Default.Parse(args, baseDirectory: Environment.CurrentDirectory, sdkDirectory: Environment.CurrentDirectory); ImmutableDictionary nullableWarnings = commandLineArguments.CompilationOptions.SpecificDiagnosticOptions; diff --git a/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj b/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj index a60a125..242542b 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers/Akade.IndexedSet.Analyzers.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 12.0 + 13.0 enable false true diff --git a/Analyzers/Akade.IndexedSet.Analyzers/AkadeIndexedSetAnalyzersCodeFixProvider.cs b/Analyzers/Akade.IndexedSet.Analyzers/AkadeIndexedSetAnalyzersCodeFixProvider.cs index 5809c40..2845a12 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers/AkadeIndexedSetAnalyzersCodeFixProvider.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers/AkadeIndexedSetAnalyzersCodeFixProvider.cs @@ -19,9 +19,12 @@ namespace Akade.IndexedSet.Analyzers; [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(AkadeIndexedSetAnalyzersCodeFixProvider)), Shared] public class AkadeIndexedSetAnalyzersCodeFixProvider : CodeFixProvider { - public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IndexNamingRulesAnalyzer.UseXAsIdentifierInLambdaRuleId, - IndexNamingRulesAnalyzer.DoNotUseParenthesesInLambdaRuleId, - IndexNamingRulesAnalyzer.DoNotUseBlockBodiedLambdaRuleId); + public sealed override ImmutableArray FixableDiagnosticIds => + [ + IndexNamingRulesAnalyzer.UseXAsIdentifierInLambdaRuleId, + IndexNamingRulesAnalyzer.DoNotUseParenthesesInLambdaRuleId, + IndexNamingRulesAnalyzer.DoNotUseBlockBodiedLambdaRuleId, + ]; public sealed override FixAllProvider GetFixAllProvider() { diff --git a/Analyzers/Akade.IndexedSet.Analyzers/ConcurrentSetUsageAnalyzers.cs b/Analyzers/Akade.IndexedSet.Analyzers/ConcurrentSetUsageAnalyzers.cs index e592624..3f8f9a9 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers/ConcurrentSetUsageAnalyzers.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers/ConcurrentSetUsageAnalyzers.cs @@ -27,7 +27,7 @@ public sealed class ConcurrentSetUsageAnalyzers : DiagnosticAnalyzer description: "Do not perform writes within a read-lock as it may result in incorrect reads, or even corrupted state.", helpLinkUri: HelpLinkBase + DoNotPerformWritesWithinReadLockRuleId); - public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(_doNotPerformWritesWithinReadLock); + public override ImmutableArray SupportedDiagnostics { get; } = [_doNotPerformWritesWithinReadLock]; public override void Initialize(AnalysisContext context) { diff --git a/Analyzers/Akade.IndexedSet.Analyzers/IndexNamingRulesAnalyzer.cs b/Analyzers/Akade.IndexedSet.Analyzers/IndexNamingRulesAnalyzer.cs index d8c803d..77533bb 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers/IndexNamingRulesAnalyzer.cs +++ b/Analyzers/Akade.IndexedSet.Analyzers/IndexNamingRulesAnalyzer.cs @@ -48,7 +48,7 @@ public sealed class IndexNamingRulesAnalyzer : DiagnosticAnalyzer description: "Use the convention of expression bodied lambdas for simple indices or static methods for more complex indices to consistently name indices.", helpLinkUri: HelpLinkBase + DoNotUseBlockBodiedLambdaRuleId); - public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(_useXInLambdaDescriptor, _doNotUseParenthesesDescriptor, _doNotUseBlockBodiedLambdaDescriptor); + public override ImmutableArray SupportedDiagnostics { get; } = [_useXInLambdaDescriptor, _doNotUseParenthesesDescriptor, _doNotUseBlockBodiedLambdaDescriptor]; public override void Initialize(AnalysisContext context) { diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index beed0ce..4f7e161 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable false diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/TestHelper.cs b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/TestHelper.cs index 26ee2d2..4b74834 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/TestHelper.cs +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/TestHelper.cs @@ -22,15 +22,10 @@ public static TestHelperWithVerify VerifySourceGen(thi return new TestHelperWithVerify(verifyBase); } - public sealed class TestHelperWithVerify + public sealed class TestHelperWithVerify(TVerifyBase verifyBase) where TVerifyBase : VerifyBase { - private readonly TVerifyBase _verifyBase; - - public TestHelperWithVerify(TVerifyBase verifyBase) - { - _verifyBase = verifyBase; - } + private readonly TVerifyBase _verifyBase = verifyBase; public Task ForSource(string source) where TSourceGen : IIncrementalGenerator, new() { @@ -52,7 +47,7 @@ internal class WriteAccessAttribute : Attribute { } var compilation = CSharpCompilation.Create( assemblyName: "Tests", - syntaxTrees: new[] { attributeSyntaxTree, syntaxTree } + syntaxTrees: [attributeSyntaxTree, syntaxTree] ); TSourceGen generator = new(); diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj index 6321fa0..bd17e32 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator/Akade.IndexedSet.InternalSourceGenerator.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 12.0 + 13.0 enable false true From 4558b48c450c1d758daf09ca45aeb8ad7c8c548a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:59:48 +0200 Subject: [PATCH 12/19] Bump Microsoft.VSSDK.BuildTools from 17.11.435 to 17.12.2069 (#169) Bumps Microsoft.VSSDK.BuildTools from 17.11.435 to 17.12.2069. --- updated-dependencies: - dependency-name: Microsoft.VSSDK.BuildTools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Akade.IndexedSet.Analyzers.Vsix.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj index d6ba73c..9d4b485 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Vsix/Akade.IndexedSet.Analyzers.Vsix.csproj @@ -19,7 +19,7 @@ - + From 5a01808579985b9f4c3be222d3c7ffb0b896aae7 Mon Sep 17 00:00:00 2001 From: Alex <16369295+akade@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:03:34 +0200 Subject: [PATCH 13/19] Benchmark-Data with .NET-9 (#171) --- docs/Benchmarks.md | 171 ++++++++++++++++++++++----------------------- 1 file changed, 85 insertions(+), 86 deletions(-) diff --git a/docs/Benchmarks.md b/docs/Benchmarks.md index 34f1328..b0b8b5d 100644 --- a/docs/Benchmarks.md +++ b/docs/Benchmarks.md @@ -17,119 +17,118 @@ the benchmarks are run against both .NET 6 and 8. .NET 7 is out of support and hence, no longer an explicit target (but the library can be consumed from .NET 7 without any issue). ## Unique-Index -| Method | Job | Runtime | Mean | Error | StdDev | Ratio | Code Size | Gen0 | Allocated | Alloc Ratio | -|----------------------------- |--------- |--------- |-------------:|----------:|----------:|------:|----------:|-------:|----------:|------------:| -| Unqiue_Linq | .NET 6.0 | .NET 6.0 | 165,871.8 ns | 527.50 ns | 411.84 ns | 1.000 | 753 B | 0.7324 | 12800 B | 1.00 | -| Unique_Dictionary | .NET 6.0 | .NET 6.0 | 474.1 ns | 0.33 ns | 0.31 ns | 0.003 | 681 B | - | - | 0.00 | -| Unique_IndexedSet_PrimaryKey | .NET 6.0 | .NET 6.0 | 1,679.1 ns | 0.98 ns | 0.87 ns | 0.010 | 512 B | - | - | 0.00 | -| Unique_IndexedSet_Single | .NET 6.0 | .NET 6.0 | 1,576.2 ns | 2.36 ns | 1.97 ns | 0.010 | 1,224 B | - | - | 0.00 | -| | | | | | | | | | | | -| Unqiue_Linq | .NET 8.0 | .NET 8.0 | 101,937.5 ns | 582.10 ns | 516.02 ns | 1.000 | 1,040 B | 0.7324 | 12800 B | 1.00 | -| Unique_Dictionary | .NET 8.0 | .NET 8.0 | 360.0 ns | 0.23 ns | 0.21 ns | 0.004 | 505 B | - | - | 0.00 | -| Unique_IndexedSet_PrimaryKey | .NET 8.0 | .NET 8.0 | 779.1 ns | 1.04 ns | 0.93 ns | 0.008 | 1,659 B | - | - | 0.00 | -| Unique_IndexedSet_Single | .NET 8.0 | .NET 8.0 | 778.3 ns | 1.20 ns | 1.00 ns | 0.008 | 1,363 B | - | - | 0.00 | +| Method | Job | Runtime | Mean | Error | StdDev | Ratio | Code Size | Gen0 | Allocated | Alloc Ratio | +|----------------------------- |--------- |--------- |------------:|------------:|----------:|------:|----------:|-------:|----------:|------------:| +| Unqiue_Linq | .NET 8.0 | .NET 8.0 | 92,618.7 ns | 1,077.03 ns | 954.76 ns | 1.000 | 1,040 B | 0.7324 | 12800 B | 1.00 | +| Unique_Dictionary | .NET 8.0 | .NET 8.0 | 373.2 ns | 0.78 ns | 0.65 ns | 0.004 | 505 B | - | - | 0.00 | +| Unique_IndexedSet_PrimaryKey | .NET 8.0 | .NET 8.0 | 788.6 ns | 0.76 ns | 0.67 ns | 0.009 | 1,631 B | - | - | 0.00 | +| Unique_IndexedSet_Single | .NET 8.0 | .NET 8.0 | 803.5 ns | 1.31 ns | 1.02 ns | 0.009 | 1,387 B | - | - | 0.00 | +| | | | | | | | | | | | +| Unqiue_Linq | .NET 9.0 | .NET 9.0 | 10,730.4 ns | 25.36 ns | 22.48 ns | 1.00 | 260 B | 0.5188 | 8800 B | 1.00 | +| Unique_Dictionary | .NET 9.0 | .NET 9.0 | 356.9 ns | 0.30 ns | 0.27 ns | 0.03 | 485 B | - | - | 0.00 | +| Unique_IndexedSet_PrimaryKey | .NET 9.0 | .NET 9.0 | 810.5 ns | 1.28 ns | 1.14 ns | 0.08 | 754 B | - | - | 0.00 | +| Unique_IndexedSet_Single | .NET 9.0 | .NET 9.0 | 746.7 ns | 1.23 ns | 1.02 ns | 0.07 | 843 B | - | - | 0.00 | > ℹ️ Note that manually maintaining a dictionary is *currently* faster but only if the executing class has direct access > to the dictionary. Ideas to bring it on par are being explored for scenarios with very tight loops around dictionary lookup. ## MultiValue-Index -| Method | Job | Runtime | Mean | Error | StdDev | Ratio | Gen0 | Code Size | Allocated | Alloc Ratio | -|---------------------- |--------- |--------- |----------:|----------:|----------:|------:|-------:|----------:|----------:|------------:| -| MultiValue_Linq | .NET 6.0 | .NET 6.0 | 62.683 μs | 0.3767 μs | 0.3524 μs | 1.00 | - | 2,575 B | 1680 B | 1.00 | -| Multivalue_Lookup | .NET 6.0 | .NET 6.0 | 12.298 μs | 0.1433 μs | 0.1340 μs | 0.20 | 0.0153 | 1,768 B | 360 B | 0.21 | -| Multivalue_IndexedSet | .NET 6.0 | .NET 6.0 | 13.071 μs | 0.0222 μs | 0.0197 μs | 0.21 | 0.0153 | 2,729 B | 360 B | 0.21 | -| | | | | | | | | | | | -| MultiValue_Linq | .NET 8.0 | .NET 8.0 | 37.620 μs | 0.6172 μs | 0.8448 μs | 1.00 | 0.0610 | 3,848 B | 1680 B | 1.00 | -| Multivalue_Lookup | .NET 8.0 | .NET 8.0 | 8.359 μs | 0.0546 μs | 0.0510 μs | 0.22 | 0.0153 | 2,869 B | 360 B | 0.21 | -| Multivalue_IndexedSet | .NET 8.0 | .NET 8.0 | 8.267 μs | 0.1633 μs | 0.1527 μs | 0.22 | 0.0153 | 3,624 B | 360 B | 0.21 | +| Method | Job | Runtime | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Code Size | Allocated | Alloc Ratio | +|---------------------- |--------- |--------- |----------:|----------:|----------:|------:|--------:|-------:|----------:|----------:|------------:| +| MultiValue_Linq | .NET 8.0 | .NET 8.0 | 34.851 μs | 0.6304 μs | 1.1206 μs | 1.00 | 0.04 | 0.0610 | 3,832 B | 1680 B | 1.00 | +| Multivalue_Lookup | .NET 8.0 | .NET 8.0 | 8.323 μs | 0.0343 μs | 0.0286 μs | 0.24 | 0.01 | 0.0153 | 2,879 B | 360 B | 0.21 | +| Multivalue_IndexedSet | .NET 8.0 | .NET 8.0 | 8.814 μs | 0.1749 μs | 0.2148 μs | 0.25 | 0.01 | 0.0153 | 3,623 B | 360 B | 0.21 | +| | | | | | | | | | | | | +| MultiValue_Linq | .NET 9.0 | .NET 9.0 | 37.035 μs | 0.6287 μs | 0.5881 μs | 1.00 | 0.02 | 0.0610 | 3,135 B | 1680 B | 1.00 | +| Multivalue_Lookup | .NET 9.0 | .NET 9.0 | 7.816 μs | 0.0377 μs | 0.0352 μs | 0.21 | 0.00 | 0.0153 | 2,412 B | 288 B | 0.17 | +| Multivalue_IndexedSet | .NET 9.0 | .NET 9.0 | 8.639 μs | 0.0633 μs | 0.0592 μs | 0.23 | 0.00 | 0.0153 | 2,772 B | 360 B | 0.21 | > ℹ️ Solution is on par with manually using LINQ's lookup (i.e. `.ToLookup()`) ## Range-Index -| Method | Job | Runtime | Mean | Error | StdDev | Ratio | Gen0 | Gen1 | Allocated | Alloc Ratio | -|-------------------- |--------- |--------- |--------------:|--------------:|------------:|------:|-------:|-------:|----------:|------------:| -| LessThan_Linq | .NET 6.0 | .NET 6.0 | 15,447.752 ns | 94.0371 ns | 73.4180 ns | 1.00 | - | - | 160 B | 1.00 | -| LessThan_IndexedSet | .NET 6.0 | .NET 6.0 | 4,572.376 ns | 7.1871 ns | 6.3712 ns | 0.30 | - | - | 72 B | 0.45 | -| | | | | | | | | | | | -| LessThan_Linq | .NET 8.0 | .NET 8.0 | 12,302.704 ns | 39.4503 ns | 36.9018 ns | 1.00 | - | - | 160 B | 1.00 | -| LessThan_IndexedSet | .NET 8.0 | .NET 8.0 | 3,713.056 ns | 2.8611 ns | 2.3892 ns | 0.30 | 0.0038 | - | 72 B | 0.45 | -| | | | | | | | | | | | -| Min_Linq | .NET 6.0 | .NET 6.0 | 76,513.335 ns | 1,015.6848 ns | 900.3781 ns | 1.000 | - | - | 40 B | 1.00 | -| Min_IndexedSet | .NET 6.0 | .NET 6.0 | 10.768 ns | 0.0468 ns | 0.0438 ns | 0.000 | - | - | - | 0.00 | -| | | | | | | | | | | | -| Min_Linq | .NET 8.0 | .NET 8.0 | 36,296.705 ns | 721.4676 ns | 858.8558 ns | 1.000 | - | - | 40 B | 1.00 | -| Min_IndexedSet | .NET 8.0 | .NET 8.0 | 5.080 ns | 0.0302 ns | 0.0282 ns | 0.000 | - | - | - | 0.00 | -| | | | | | | | | | | | -| Paging_Linq | .NET 6.0 | .NET 6.0 | 74,342.609 ns | 413.9514 ns | 387.2104 ns | 1.000 | 9.5215 | 2.3193 | 160352 B | 1.000 | -| Paging_IndexedSet | .NET 6.0 | .NET 6.0 | 189.378 ns | 0.5182 ns | 0.4594 ns | 0.003 | 0.0277 | - | 464 B | 0.003 | -| | | | | | | | | | | | -| Paging_Linq | .NET 8.0 | .NET 8.0 | 46,618.368 ns | 199.4397 ns | 176.7981 ns | 1.000 | 9.5215 | 2.3804 | 160352 B | 1.000 | -| Paging_IndexedSet | .NET 8.0 | .NET 8.0 | 149.267 ns | 2.0515 ns | 1.9190 ns | 0.003 | 0.0277 | - | 464 B | 0.003 | -| | | | | | | | | | | | -| Range_Linq | .NET 6.0 | .NET 6.0 | 22,935.722 ns | 392.1182 ns | 366.7876 ns | 1.00 | - | - | 168 B | 1.00 | -| Range_IndexedSet | .NET 6.0 | .NET 6.0 | 3,608.993 ns | 18.2732 ns | 14.2665 ns | 0.16 | 0.0038 | - | 72 B | 0.43 | -| | | | | | | | | | | | -| Range_Linq | .NET 8.0 | .NET 8.0 | 14,482.250 ns | 283.2456 ns | 406.2223 ns | 1.00 | - | - | 160 B | 1.00 | -| Range_IndexedSet | .NET 8.0 | .NET 8.0 | 2,921.471 ns | 3.4446 ns | 2.8764 ns | 0.20 | 0.0038 | - | 72 B | 0.45 | +| Method | Job | Runtime | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio | +|-------------------- |--------- |--------- |--------------:|------------:|------------:|------:|--------:|-------:|-------:|----------:|------------:| +| LessThan_Linq | .NET 8.0 | .NET 8.0 | 12,172.573 ns | 65.0425 ns | 60.8408 ns | 1.00 | 0.01 | - | - | 160 B | 1.00 | +| LessThan_IndexedSet | .NET 8.0 | .NET 8.0 | 3,439.486 ns | 5.9086 ns | 5.5269 ns | 0.28 | 0.00 | 0.0038 | - | 72 B | 0.45 | +| | | | | | | | | | | | | +| LessThan_Linq | .NET 9.0 | .NET 9.0 | 4,379.574 ns | 26.8995 ns | 23.8457 ns | 1.00 | 0.01 | 0.0076 | - | 160 B | 1.00 | +| LessThan_IndexedSet | .NET 9.0 | .NET 9.0 | 3,449.437 ns | 8.2712 ns | 6.9068 ns | 0.79 | 0.00 | 0.0038 | - | 72 B | 0.45 | +| | | | | | | | | | | | | +| Min_Linq | .NET 8.0 | .NET 8.0 | 35,974.568 ns | 715.3502 ns | 765.4167 ns | 1.000 | 0.03 | - | - | 40 B | 1.00 | +| Min_IndexedSet | .NET 8.0 | .NET 8.0 | 5.179 ns | 0.0153 ns | 0.0143 ns | 0.000 | 0.00 | - | - | - | 0.00 | +| | | | | | | | | | | | | +| Min_Linq | .NET 9.0 | .NET 9.0 | 30,744.936 ns | 607.9471 ns | 746.6137 ns | 1.001 | 0.03 | - | - | 40 B | 1.00 | +| Min_IndexedSet | .NET 9.0 | .NET 9.0 | 4.948 ns | 0.0066 ns | 0.0062 ns | 0.000 | 0.00 | - | - | - | 0.00 | +| | | | | | | | | | | | | +| Paging_Linq | .NET 8.0 | .NET 8.0 | 42,730.709 ns | 165.4306 ns | 154.7439 ns | 1.000 | 0.00 | 9.5215 | 2.3804 | 160352 B | 1.000 | +| Paging_IndexedSet | .NET 8.0 | .NET 8.0 | 146.687 ns | 2.1497 ns | 2.0108 ns | 0.003 | 0.00 | 0.0277 | - | 464 B | 0.003 | +| | | | | | | | | | | | | +| Paging_Linq | .NET 9.0 | .NET 9.0 | 41,435.160 ns | 455.6568 ns | 426.2217 ns | 1.000 | 0.01 | 9.5215 | 1.1597 | 160464 B | 1.000 | +| Paging_IndexedSet | .NET 9.0 | .NET 9.0 | 121.028 ns | 0.6311 ns | 0.5903 ns | 0.003 | 0.00 | 0.0138 | - | 232 B | 0.001 | +| | | | | | | | | | | | | +| Range_Linq | .NET 8.0 | .NET 8.0 | 13,410.602 ns | 65.6024 ns | 61.3645 ns | 1.00 | 0.01 | - | - | 160 B | 1.00 | +| Range_IndexedSet | .NET 8.0 | .NET 8.0 | 2,919.190 ns | 2.2875 ns | 1.7859 ns | 0.22 | 0.00 | 0.0038 | - | 72 B | 0.45 | +| | | | | | | | | | | | | +| Range_Linq | .NET 9.0 | .NET 9.0 | 4,440.144 ns | 20.0350 ns | 18.7407 ns | 1.00 | 0.01 | 0.0076 | - | 160 B | 1.00 | +| Range_IndexedSet | .NET 9.0 | .NET 9.0 | 2,713.934 ns | 9.9596 ns | 8.8289 ns | 0.61 | 0.00 | 0.0038 | - | 72 B | 0.45 | > ℹ️ There is no built-in range data structure, hence no comparison. Paging covers sorting scenarios, while min-queries cover MinBy and MaxBy-Queries as well. ## Prefix-Index | Method | Job | Runtime | Mean | Error | StdDev | Ratio | Gen0 | Allocated | Alloc Ratio | |--------------------------- |--------- |--------- |------------:|----------:|----------:|------:|-------:|----------:|------------:| -| FuzzyStartsWith_Linq | .NET 6.0 | .NET 6.0 | 66,355.7 ns | 275.48 ns | 230.04 ns | 1.00 | 5.7373 | 96088 B | 1.000 | -| FuzzyStartsWith_IndexedSet | .NET 6.0 | .NET 6.0 | 21,151.0 ns | 26.36 ns | 24.66 ns | 0.32 | - | 240 B | 0.002 | +| FuzzyStartsWith_Linq | .NET 8.0 | .NET 8.0 | 58,900.4 ns | 187.75 ns | 175.62 ns | 1.00 | 5.7373 | 96088 B | 1.000 | +| FuzzyStartsWith_IndexedSet | .NET 8.0 | .NET 8.0 | 15,862.9 ns | 51.72 ns | 43.19 ns | 0.27 | - | 240 B | 0.002 | | | | | | | | | | | | -| FuzzyStartsWith_Linq | .NET 8.0 | .NET 8.0 | 59,134.2 ns | 216.75 ns | 192.15 ns | 1.00 | 5.7373 | 96088 B | 1.000 | -| FuzzyStartsWith_IndexedSet | .NET 8.0 | .NET 8.0 | 15,645.4 ns | 54.92 ns | 42.88 ns | 0.26 | - | 240 B | 0.002 | +| FuzzyStartsWith_Linq | .NET 9.0 | .NET 9.0 | 61,080.0 ns | 230.47 ns | 215.58 ns | 1.00 | 5.7373 | 96088 B | 1.000 | +| FuzzyStartsWith_IndexedSet | .NET 9.0 | .NET 9.0 | 13,758.7 ns | 21.79 ns | 17.01 ns | 0.23 | - | 240 B | 0.002 | | | | | | | | | | | | -| StartsWith_Linq | .NET 6.0 | .NET 6.0 | 3,854.5 ns | 16.95 ns | 15.86 ns | 1.00 | 0.0076 | 128 B | 1.00 | -| StartsWith_IndexedSet | .NET 6.0 | .NET 6.0 | 699.8 ns | 0.40 ns | 0.33 ns | 0.18 | 0.0086 | 144 B | 1.12 | +| StartsWith_Linq | .NET 8.0 | .NET 8.0 | 2,137.0 ns | 1.58 ns | 1.40 ns | 1.00 | 0.0076 | 128 B | 1.00 | +| StartsWith_IndexedSet | .NET 8.0 | .NET 8.0 | 592.4 ns | 1.11 ns | 1.04 ns | 0.28 | 0.0086 | 144 B | 1.12 | | | | | | | | | | | | -| StartsWith_Linq | .NET 8.0 | .NET 8.0 | 2,175.6 ns | 6.48 ns | 6.06 ns | 1.00 | 0.0076 | 128 B | 1.00 | -| StartsWith_IndexedSet | .NET 8.0 | .NET 8.0 | 607.8 ns | 0.52 ns | 0.49 ns | 0.28 | 0.0086 | 144 B | 1.12 | - +| StartsWith_Linq | .NET 9.0 | .NET 9.0 | 1,347.1 ns | 0.99 ns | 0.83 ns | 1.00 | 0.0076 | 128 B | 1.00 | +| StartsWith_IndexedSet | .NET 9.0 | .NET 9.0 | 381.8 ns | 0.54 ns | 0.48 ns | 0.28 | 0.0086 | 144 B | 1.12 | > ℹ️ Fuzzy-Matching of string pairs within the Linq-Benchmark is done with [Fastenshtein](https://github.com/DanHarltey/Fastenshtein) ## FullText-Index -| Method | Job | Runtime | Mean | Error | StdDev | Median | Ratio | Gen0 | Allocated | Alloc Ratio | -|------------------------- |--------- |--------- |---------------:|-------------:|-------------:|---------------:|------:|---------:|----------:|------------:| -| Contains_Linq | .NET 6.0 | .NET 6.0 | 16,860.5 ns | 104.58 ns | 97.82 ns | 16,824.8 ns | 1.00 | - | 408 B | 1.00 | -| Contains_IndexedSet | .NET 6.0 | .NET 6.0 | 494.3 ns | 9.82 ns | 17.95 ns | 481.1 ns | 0.03 | 0.0238 | 400 B | 0.98 | -| | | | | | | | | | | | -| Contains_Linq | .NET 8.0 | .NET 8.0 | 6,414.3 ns | 13.07 ns | 11.58 ns | 6,412.4 ns | 1.00 | 0.0229 | 408 B | 1.00 | -| Contains_IndexedSet | .NET 8.0 | .NET 8.0 | 493.9 ns | 0.66 ns | 0.56 ns | 493.8 ns | 0.08 | 0.0238 | 400 B | 0.98 | -| | | | | | | | | | | | -| FuzzyContains_Linq | .NET 6.0 | .NET 6.0 | 7,093,172.0 ns | 18,687.32 ns | 16,565.82 ns | 7,092,050.8 ns | 1.00 | 281.2500 | 4831745 B | 1.000 | -| FuzzyContains_IndexedSet | .NET 6.0 | .NET 6.0 | 189,163.9 ns | 696.50 ns | 651.50 ns | 189,138.3 ns | 0.03 | - | 608 B | 0.000 | -| | | | | | | | | | | | -| FuzzyContains_Linq | .NET 8.0 | .NET 8.0 | 6,418,291.2 ns | 74,491.47 ns | 62,203.75 ns | 6,391,822.7 ns | 1.00 | 281.2500 | 4831742 B | 1.000 | -| FuzzyContains_IndexedSet | .NET 8.0 | .NET 8.0 | 138,812.8 ns | 394.75 ns | 349.94 ns | 138,727.1 ns | 0.02 | - | 608 B | 0.000 | +| Method | Job | Runtime | Mean | Error | StdDev | Ratio | Gen0 | Allocated | Alloc Ratio | +|------------------------- |--------- |--------- |---------------:|-------------:|-------------:|------:|---------:|----------:|------------:| +| Contains_Linq | .NET 8.0 | .NET 8.0 | 5,683.6 ns | 5.98 ns | 5.60 ns | 1.00 | 0.0229 | 408 B | 1.00 | +| Contains_IndexedSet | .NET 8.0 | .NET 8.0 | 424.4 ns | 0.52 ns | 0.46 ns | 0.07 | 0.0238 | 400 B | 0.98 | +| | | | | | | | | | | +| Contains_Linq | .NET 9.0 | .NET 9.0 | 5,003.8 ns | 5.28 ns | 4.68 ns | 1.00 | 0.0076 | 176 B | 1.00 | +| Contains_IndexedSet | .NET 9.0 | .NET 9.0 | 337.7 ns | 0.80 ns | 0.75 ns | 0.07 | 0.0238 | 400 B | 2.27 | +| | | | | | | | | | | +| FuzzyContains_Linq | .NET 8.0 | .NET 8.0 | 6,252,849.7 ns | 11,934.09 ns | 11,163.15 ns | 1.00 | 281.2500 | 4831742 B | 1.000 | +| FuzzyContains_IndexedSet | .NET 8.0 | .NET 8.0 | 140,481.3 ns | 325.54 ns | 304.51 ns | 0.02 | - | 608 B | 0.000 | +| | | | | | | | | | | +| FuzzyContains_Linq | .NET 9.0 | .NET 9.0 | 5,974,308.9 ns | 17,245.07 ns | 16,131.04 ns | 1.00 | 281.2500 | 4831736 B | 1.000 | +| FuzzyContains_IndexedSet | .NET 9.0 | .NET 9.0 | 124,523.5 ns | 789.63 ns | 738.62 ns | 0.02 | - | 608 B | 0.000 | > ℹ️ Fuzzy-Matching of string pairs within the Linq-Benchmark is done with [Fastenshtein](https://github.com/DanHarltey/Fastenshtein) and enumerating possible infixes. ## ConcurrentSet -| Method | Job | Runtime | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | -|------------------------- |--------- |--------- |--------------:|-----------:|-----------:|--------------:|------:|--------:|-------:|----------:|------------:| -| FullTextLookup | .NET 6.0 | .NET 6.0 | 25,215.813 ns | 96.5161 ns | 85.5590 ns | 25,203.891 ns | 1.00 | 0.00 | - | 424 B | 1.00 | -| ConcurrentFullTextLookup | .NET 6.0 | .NET 6.0 | 25,208.556 ns | 45.0981 ns | 39.9783 ns | 25,202.513 ns | 1.00 | 0.00 | - | 464 B | 1.09 | -| | | | | | | | | | | | | -| FullTextLookup | .NET 8.0 | .NET 8.0 | 17,750.163 ns | 21.3387 ns | 17.8188 ns | 17,749.068 ns | 1.00 | 0.00 | - | 424 B | 1.00 | -| ConcurrentFullTextLookup | .NET 8.0 | .NET 8.0 | 17,844.096 ns | 49.3671 ns | 46.1780 ns | 17,832.971 ns | 1.01 | 0.00 | - | 464 B | 1.09 | -| | | | | | | | | | | | | -| LessThanLookup | .NET 6.0 | .NET 6.0 | 25.078 ns | 0.1039 ns | 0.0971 ns | 25.041 ns | 1.00 | 0.00 | 0.0038 | 64 B | 1.00 | -| ConcurrentLessThanLookup | .NET 6.0 | .NET 6.0 | 52.316 ns | 0.1319 ns | 0.1169 ns | 52.307 ns | 2.09 | 0.01 | 0.0038 | 64 B | 1.00 | -| | | | | | | | | | | | | -| LessThanLookup | .NET 8.0 | .NET 8.0 | 9.451 ns | 0.0112 ns | 0.0099 ns | 9.450 ns | 1.00 | 0.00 | - | - | NA | -| ConcurrentLessThanLookup | .NET 8.0 | .NET 8.0 | 45.381 ns | 0.9246 ns | 2.1613 ns | 44.943 ns | 4.88 | 0.30 | - | - | NA | -| | | | | | | | | | | | | -| UniqueLookup | .NET 6.0 | .NET 6.0 | 15.515 ns | 0.0645 ns | 0.0604 ns | 15.523 ns | 1.00 | 0.00 | - | - | NA | -| ConcurrentUniqueLookup | .NET 6.0 | .NET 6.0 | 34.343 ns | 0.1085 ns | 0.0962 ns | 34.339 ns | 2.21 | 0.01 | - | - | NA | -| | | | | | | | | | | | | -| UniqueLookup | .NET 8.0 | .NET 8.0 | 9.690 ns | 0.0387 ns | 0.0362 ns | 9.677 ns | 1.00 | 0.00 | - | - | NA | -| ConcurrentUniqueLookup | .NET 8.0 | .NET 8.0 | 33.247 ns | 0.8520 ns | 2.5122 ns | 33.908 ns | 3.03 | 0.24 | - | - | NA | +| Method | Job | Runtime | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | +|------------------------- |--------- |--------- |--------------:|-----------:|-----------:|------:|--------:|----------:|------------:| +| FullTextLookup | .NET 8.0 | .NET 8.0 | 17,781.201 ns | 30.5715 ns | 28.5966 ns | 1.00 | 0.00 | 424 B | 1.00 | +| ConcurrentFullTextLookup | .NET 8.0 | .NET 8.0 | 17,562.165 ns | 39.1982 ns | 34.7482 ns | 0.99 | 0.00 | 464 B | 1.09 | +| | | | | | | | | | | +| FullTextLookup | .NET 9.0 | .NET 9.0 | 16,162.325 ns | 13.2668 ns | 10.3578 ns | 1.00 | 0.00 | 424 B | 1.00 | +| ConcurrentFullTextLookup | .NET 9.0 | .NET 9.0 | 16,220.753 ns | 25.7419 ns | 22.8195 ns | 1.00 | 0.00 | 464 B | 1.09 | +| | | | | | | | | | | +| LessThanLookup | .NET 8.0 | .NET 8.0 | 10.967 ns | 0.0387 ns | 0.0343 ns | 1.00 | 0.00 | - | NA | +| ConcurrentLessThanLookup | .NET 8.0 | .NET 8.0 | 56.053 ns | 0.8625 ns | 0.7646 ns | 5.11 | 0.07 | - | NA | +| | | | | | | | | | | +| LessThanLookup | .NET 9.0 | .NET 9.0 | 12.063 ns | 0.0193 ns | 0.0180 ns | 1.00 | 0.00 | - | NA | +| ConcurrentLessThanLookup | .NET 9.0 | .NET 9.0 | 41.691 ns | 0.8385 ns | 0.9656 ns | 3.46 | 0.08 | - | NA | +| | | | | | | | | | | +| UniqueLookup | .NET 8.0 | .NET 8.0 | 9.380 ns | 0.0273 ns | 0.0242 ns | 1.00 | 0.00 | - | NA | +| ConcurrentUniqueLookup | .NET 8.0 | .NET 8.0 | 33.221 ns | 0.6806 ns | 1.7447 ns | 3.54 | 0.19 | - | NA | +| | | | | | | | | | | +| UniqueLookup | .NET 9.0 | .NET 9.0 | 8.900 ns | 0.0231 ns | 0.0205 ns | 1.00 | 0.00 | - | NA | +| ConcurrentUniqueLookup | .NET 9.0 | .NET 9.0 | 24.075 ns | 0.4980 ns | 1.0396 ns | 2.71 | 0.12 | - | NA | > ℹ️ For more complex scenarios, the synchronization cost is negligible. For simple queries, it is not. The difference in allocated memory is due to materialization of results in the concurrent case. From 29b54be7bae06855f5c19eaf5d7f782472f83d09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:12:43 +0100 Subject: [PATCH 14/19] Bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0 (#179) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.11.1 to 17.12.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.11.1...v17.12.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj | 2 +- .../Akade.IndexedSet.Analyzers.Test.csproj | 2 +- .../Akade.IndexedSet.InternalSourceGenerator.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj index 4eb4cd9..5bf21f8 100644 --- a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj +++ b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj index 2f4e927..4fcb7fe 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj @@ -8,7 +8,7 @@ - + diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index 4f7e161..bc8ddf3 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -8,7 +8,7 @@ - + From 5fdf3ed287237b9991159a37264a528e360f0bf3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:12:59 +0100 Subject: [PATCH 15/19] Bump dotnet-reportgenerator-globaltool from 5.3.11 to 5.4.1 (#178) Bumps [dotnet-reportgenerator-globaltool](https://github.com/danielpalme/ReportGenerator) from 5.3.11 to 5.4.1. - [Release notes](https://github.com/danielpalme/ReportGenerator/releases) - [Commits](https://github.com/danielpalme/ReportGenerator/compare/v5.3.11...v5.4.1) --- updated-dependencies: - dependency-name: dotnet-reportgenerator-globaltool dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index d235bb8..e44f1ad 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-reportgenerator-globaltool": { - "version": "5.3.11", + "version": "5.4.1", "commands": [ "reportgenerator" ] From 69746a884da187b99264193730d03f9b65936470 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:13:26 +0100 Subject: [PATCH 16/19] Bump MSTest.TestFramework from 3.6.1 to 3.6.3 (#176) Bumps [MSTest.TestFramework](https://github.com/microsoft/testfx) from 3.6.1 to 3.6.3. - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/commits) --- updated-dependencies: - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj | 2 +- .../Akade.IndexedSet.Analyzers.Test.csproj | 2 +- .../Akade.IndexedSet.InternalSourceGenerator.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj index 5bf21f8..86bd084 100644 --- a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj +++ b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj @@ -11,7 +11,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj index 4fcb7fe..fb14c91 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj @@ -10,7 +10,7 @@ - + diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index bc8ddf3..98a31d4 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -10,7 +10,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 2a3f9c9baeda5343352643a3dfda0044764be80f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:19:15 +0100 Subject: [PATCH 17/19] Bump MSTest.TestAdapter from 3.6.1 to 3.6.3 (#177) Bumps [MSTest.TestAdapter](https://github.com/microsoft/testfx) from 3.6.1 to 3.6.3. - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/commits) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj | 2 +- .../Akade.IndexedSet.Analyzers.Test.csproj | 2 +- .../Akade.IndexedSet.InternalSourceGenerator.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj index 86bd084..d090f59 100644 --- a/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj +++ b/Akade.IndexedSet.Tests/Akade.IndexedSet.Tests.csproj @@ -10,7 +10,7 @@ - + all diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj index fb14c91..a78277b 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj @@ -9,7 +9,7 @@ - + diff --git a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj index 98a31d4..7f16983 100644 --- a/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj +++ b/SourceGenerator/Akade.IndexedSet.InternalSourceGenerator.Tests/Akade.IndexedSet.InternalSourceGenerator.Tests.csproj @@ -9,7 +9,7 @@ - + all From a41b0be61b99c8ce0c96ce426203dd5b02410ddf Mon Sep 17 00:00:00 2001 From: Alex <16369295+akade@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:31:33 +0100 Subject: [PATCH 18/19] Updated System.Formats.Asn1 to use a non-vulnerable version (was a transitive dependency) (#180) --- .../Akade.IndexedSet.Analyzers.Test.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj index a78277b..bf2997f 100644 --- a/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj +++ b/Analyzers/Akade.IndexedSet.Analyzers.Test/Akade.IndexedSet.Analyzers.Test.csproj @@ -18,6 +18,7 @@ + From 87dde4185c85a1db96c2103ad6dd1c4b4d44dc5a Mon Sep 17 00:00:00 2001 From: Alex <16369295+akade@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:37:04 +0100 Subject: [PATCH 19/19] Version 1.3 (#181) --- Akade.IndexedSet/Akade.IndexedSet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Akade.IndexedSet/Akade.IndexedSet.csproj b/Akade.IndexedSet/Akade.IndexedSet.csproj index e8de609..bc6cb1b 100644 --- a/Akade.IndexedSet/Akade.IndexedSet.csproj +++ b/Akade.IndexedSet/Akade.IndexedSet.csproj @@ -7,7 +7,7 @@ - 1.2.0 + 1.3.0 Provides an In-Memory data structure, the IndexedSet, that allows to easily add indices to allow efficient querying. Currently supports unique and non-unique indices, range indices as well as fuzzy string matching for single attributes, compound or computed keys. Copyright © Akade 2024 Akade