Skip to content

Commit 7971869

Browse files
Switch to automated compatibility testing (#716)
1 parent b46fb64 commit 7971869

34 files changed

+134
-5054
lines changed

Directory.Packages.props

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
1515
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.12.0" />
1616
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
17-
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
1817
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.12.0" />
1918
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.12.0" />
2019
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />

Source/SuperLinq.Async/Join.MergeJoin.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,10 @@ IComparer<TKey> comparer
723723
) : IEqualityComparer<TKey>
724724
{
725725
public bool Equals([AllowNull] TKey x, [AllowNull] TKey y) => comparer.Compare(x!, y!) == 0;
726+
public int GetHashCode(
726727
#if NETCOREAPP
727-
public int GetHashCode([DisallowNull] TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
728-
#else
729-
public int GetHashCode(TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
728+
[DisallowNull]
730729
#endif
730+
TKey obj
731+
) => ThrowHelper.ThrowNotSupportedException<int>();
731732
}

Source/SuperLinq.Async/PublicAPI/net6.0/PublicAPI.Shipped.txt

-387
This file was deleted.

Source/SuperLinq.Async/PublicAPI/net6.0/PublicAPI.Unshipped.txt

-1
This file was deleted.

Source/SuperLinq.Async/PublicAPI/net7.0/PublicAPI.Shipped.txt

-387
This file was deleted.

Source/SuperLinq.Async/PublicAPI/net7.0/PublicAPI.Unshipped.txt

-1
This file was deleted.

Source/SuperLinq.Async/PublicAPI/net8.0/PublicAPI.Shipped.txt

-387
This file was deleted.

Source/SuperLinq.Async/PublicAPI/net8.0/PublicAPI.Unshipped.txt

-1
This file was deleted.

Source/SuperLinq.Async/PublicAPI/net9.0/PublicAPI.Shipped.txt

-387
This file was deleted.

Source/SuperLinq.Async/PublicAPI/net9.0/PublicAPI.Unshipped.txt

-1
This file was deleted.

Source/SuperLinq.Async/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt

-387
This file was deleted.

Source/SuperLinq.Async/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt

-1
This file was deleted.

Source/SuperLinq.Async/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt

-1
This file was deleted.

Source/SuperLinq.Async/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt

-366
This file was deleted.

Source/SuperLinq.Async/SortedMerge.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,15 @@ static async IAsyncEnumerable<TSource> Impl(
372372
}
373373
}
374374
}
375+
}
375376

376377
#if !NET6_0_OR_GREATER
377-
internal sealed class SourceComparer<TItem, TKey>(
378-
IComparer<TKey> keyComparer,
379-
Func<TItem, TKey> keySelector
380-
) : IComparer<IAsyncEnumerator<TItem>>
381-
{
382-
public int Compare(IAsyncEnumerator<TItem>? x, IAsyncEnumerator<TItem>? y) =>
383-
keyComparer.Compare(keySelector(x!.Current), keySelector(y!.Current));
384-
}
385-
#endif
378+
file sealed class SourceComparer<TItem, TKey>(
379+
IComparer<TKey> keyComparer,
380+
Func<TItem, TKey> keySelector
381+
) : IComparer<IAsyncEnumerator<TItem>>
382+
{
383+
public int Compare(IAsyncEnumerator<TItem>? x, IAsyncEnumerator<TItem>? y) =>
384+
keyComparer.Compare(keySelector(x!.Current), keySelector(y!.Current));
386385
}
386+
#endif

Source/SuperLinq.Async/SuperLinq.Async.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<RootNamespace>SuperLinq.Async</RootNamespace>
88

99
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
10+
11+
<EnablePackageValidation>true</EnablePackageValidation>
12+
<PackageValidationBaselineVersion>6.0.0</PackageValidationBaselineVersion>
1013
</PropertyGroup>
1114

1215
<PropertyGroup Label="Nuget">
@@ -104,8 +107,6 @@
104107

105108
<ItemGroup>
106109
<None Include="readme.md" Pack="true" PackagePath="\" />
107-
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Shipped.txt" />
108-
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />
109110
</ItemGroup>
110111

111112
<ItemGroup>
@@ -116,7 +117,6 @@
116117
<ItemGroup>
117118
<PackageReference Include="DotNet.ReproducibleBuilds" PrivateAssets="All" />
118119
<PackageReference Include="Microsoft.Bcl.HashCode" />
119-
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="All" />
120120
<PackageReference Include="MinVer" PrivateAssets="All" />
121121
<PackageReference Include="System.Linq.Async" />
122122
<PackageReference Include="System.Memory" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
3+
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
4+
<Suppression>
5+
<DiagnosticId>CP0002</DiagnosticId>
6+
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{``0,``1}},System.Collections.Generic.IEqualityComparer{``0})</Target>
7+
<Left>lib/net6.0/SuperLinq.dll</Left>
8+
<Right>lib/net8.0/SuperLinq.dll</Right>
9+
</Suppression>
10+
<Suppression>
11+
<DiagnosticId>CP0002</DiagnosticId>
12+
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{``0,``1}})</Target>
13+
<Left>lib/net6.0/SuperLinq.dll</Left>
14+
<Right>lib/net8.0/SuperLinq.dll</Right>
15+
</Suppression>
16+
<Suppression>
17+
<DiagnosticId>CP0002</DiagnosticId>
18+
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.ValueTuple{``0,``1}},System.Collections.Generic.IEqualityComparer{``0})</Target>
19+
<Left>lib/net6.0/SuperLinq.dll</Left>
20+
<Right>lib/net8.0/SuperLinq.dll</Right>
21+
</Suppression>
22+
<Suppression>
23+
<DiagnosticId>CP0002</DiagnosticId>
24+
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.ValueTuple{``0,``1}})</Target>
25+
<Left>lib/net6.0/SuperLinq.dll</Left>
26+
<Right>lib/net8.0/SuperLinq.dll</Right>
27+
</Suppression>
28+
<Suppression>
29+
<DiagnosticId>CP0002</DiagnosticId>
30+
<Target>M:SuperLinq.SuperEnumerable.AggregateBy``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},``2,System.Func{``2,``0,``2},System.Collections.Generic.IEqualityComparer{``1})</Target>
31+
<Left>lib/net8.0/SuperLinq.dll</Left>
32+
<Right>lib/net9.0/SuperLinq.dll</Right>
33+
</Suppression>
34+
<Suppression>
35+
<DiagnosticId>CP0002</DiagnosticId>
36+
<Target>M:SuperLinq.SuperEnumerable.AggregateBy``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Func{``1,``2},System.Func{``2,``0,``2},System.Collections.Generic.IEqualityComparer{``1})</Target>
37+
<Left>lib/net8.0/SuperLinq.dll</Left>
38+
<Right>lib/net9.0/SuperLinq.dll</Right>
39+
</Suppression>
40+
<Suppression>
41+
<DiagnosticId>CP0002</DiagnosticId>
42+
<Target>M:SuperLinq.SuperEnumerable.CountBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IEqualityComparer{``1})</Target>
43+
<Left>lib/net8.0/SuperLinq.dll</Left>
44+
<Right>lib/net9.0/SuperLinq.dll</Right>
45+
</Suppression>
46+
<Suppression>
47+
<DiagnosticId>CP0002</DiagnosticId>
48+
<Target>M:SuperLinq.SuperEnumerable.CountBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1})</Target>
49+
<Left>lib/net8.0/SuperLinq.dll</Left>
50+
<Right>lib/net9.0/SuperLinq.dll</Right>
51+
</Suppression>
52+
<Suppression>
53+
<DiagnosticId>CP0002</DiagnosticId>
54+
<Target>M:SuperLinq.SuperEnumerable.Index``1(System.Collections.Generic.IEnumerable{``0})</Target>
55+
<Left>lib/net8.0/SuperLinq.dll</Left>
56+
<Right>lib/net9.0/SuperLinq.dll</Right>
57+
</Suppression>
58+
<Suppression>
59+
<DiagnosticId>CP0002</DiagnosticId>
60+
<Target>M:SuperLinq.SuperEnumerable.DistinctBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IEqualityComparer{``1})</Target>
61+
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
62+
<Right>lib/net6.0/SuperLinq.dll</Right>
63+
</Suppression>
64+
<Suppression>
65+
<DiagnosticId>CP0002</DiagnosticId>
66+
<Target>M:SuperLinq.SuperEnumerable.DistinctBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1})</Target>
67+
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
68+
<Right>lib/net6.0/SuperLinq.dll</Right>
69+
</Suppression>
70+
<Suppression>
71+
<DiagnosticId>CP0002</DiagnosticId>
72+
<Target>M:SuperLinq.SuperEnumerable.ElementAt``1(System.Collections.Generic.IEnumerable{``0},System.Index)</Target>
73+
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
74+
<Right>lib/net6.0/SuperLinq.dll</Right>
75+
</Suppression>
76+
<Suppression>
77+
<DiagnosticId>CP0002</DiagnosticId>
78+
<Target>M:SuperLinq.SuperEnumerable.ElementAtOrDefault``1(System.Collections.Generic.IEnumerable{``0},System.Index)</Target>
79+
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
80+
<Right>lib/net6.0/SuperLinq.dll</Right>
81+
</Suppression>
82+
<Suppression>
83+
<DiagnosticId>CP0002</DiagnosticId>
84+
<Target>M:SuperLinq.SuperEnumerable.Take``1(System.Collections.Generic.IEnumerable{``0},System.Range)</Target>
85+
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
86+
<Right>lib/net6.0/SuperLinq.dll</Right>
87+
</Suppression>
88+
<Suppression>
89+
<DiagnosticId>CP0008</DiagnosticId>
90+
<Target>T:SuperLinq.OrderByDirection</Target>
91+
<Left>lib/net7.0/SuperLinq.dll</Left>
92+
<Right>lib/net6.0/SuperLinq.dll</Right>
93+
<IsBaselineSuppression>true</IsBaselineSuppression>
94+
</Suppression>
95+
</Suppressions>

Source/SuperLinq/UnreachableException.cs Source/SuperLinq/Exceptions/UnreachableException.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66
#if !NET7_0_OR_GREATER
77
using System.Diagnostics.CodeAnalysis;
8-
#endif
98

109
namespace System.Diagnostics;
1110

12-
#if !NET7_0_OR_GREATER
1311
/// <summary>
1412
/// Exception thrown when the program executes an instruction that was thought to be unreachable.
1513
/// </summary>
@@ -43,4 +41,8 @@ public UnreachableException(string? message, Exception? innerException)
4341
: base(message, innerException)
4442
{ }
4543
}
44+
#else
45+
using System.Runtime.CompilerServices;
46+
47+
[assembly: TypeForwardedTo(typeof(System.Diagnostics.UnreachableException))]
4648
#endif

Source/SuperLinq/Join.MergeJoin.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,10 @@ IComparer<TKey> comparer
726726
) : IEqualityComparer<TKey>
727727
{
728728
public bool Equals([AllowNull] TKey x, [AllowNull] TKey y) => comparer.Compare(x!, y!) == 0;
729+
public int GetHashCode(
729730
#if NETCOREAPP
730-
public int GetHashCode([DisallowNull] TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
731-
#else
732-
public int GetHashCode(TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
731+
[DisallowNull]
733732
#endif
733+
TKey obj
734+
) => ThrowHelper.ThrowNotSupportedException<int>();
734735
}

0 commit comments

Comments
 (0)