Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to automated compatibility testing #716

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
Expand Down
7 changes: 4 additions & 3 deletions Source/SuperLinq.Async/Join.MergeJoin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,10 @@
) : IEqualityComparer<TKey>
{
public bool Equals([AllowNull] TKey x, [AllowNull] TKey y) => comparer.Compare(x!, y!) == 0;
public int GetHashCode(
#if NETCOREAPP
public int GetHashCode([DisallowNull] TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
#else
public int GetHashCode(TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
[DisallowNull]
#endif
TKey obj
) => ThrowHelper.ThrowNotSupportedException<int>();

Check warning on line 731 in Source/SuperLinq.Async/Join.MergeJoin.cs

View check run for this annotation

Codecov / codecov/patch

Source/SuperLinq.Async/Join.MergeJoin.cs#L731

Added line #L731 was not covered by tests
}
387 changes: 0 additions & 387 deletions Source/SuperLinq.Async/PublicAPI/net6.0/PublicAPI.Shipped.txt

This file was deleted.

This file was deleted.

387 changes: 0 additions & 387 deletions Source/SuperLinq.Async/PublicAPI/net7.0/PublicAPI.Shipped.txt

This file was deleted.

This file was deleted.

387 changes: 0 additions & 387 deletions Source/SuperLinq.Async/PublicAPI/net8.0/PublicAPI.Shipped.txt

This file was deleted.

This file was deleted.

387 changes: 0 additions & 387 deletions Source/SuperLinq.Async/PublicAPI/net9.0/PublicAPI.Shipped.txt

This file was deleted.

This file was deleted.

387 changes: 0 additions & 387 deletions Source/SuperLinq.Async/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 9 additions & 9 deletions Source/SuperLinq.Async/SortedMerge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,15 @@ static async IAsyncEnumerable<TSource> Impl(
}
}
}
}

#if !NET6_0_OR_GREATER
internal sealed class SourceComparer<TItem, TKey>(
IComparer<TKey> keyComparer,
Func<TItem, TKey> keySelector
) : IComparer<IAsyncEnumerator<TItem>>
{
public int Compare(IAsyncEnumerator<TItem>? x, IAsyncEnumerator<TItem>? y) =>
keyComparer.Compare(keySelector(x!.Current), keySelector(y!.Current));
}
#endif
file sealed class SourceComparer<TItem, TKey>(
IComparer<TKey> keyComparer,
Func<TItem, TKey> keySelector
) : IComparer<IAsyncEnumerator<TItem>>
{
public int Compare(IAsyncEnumerator<TItem>? x, IAsyncEnumerator<TItem>? y) =>
keyComparer.Compare(keySelector(x!.Current), keySelector(y!.Current));
}
#endif
6 changes: 3 additions & 3 deletions Source/SuperLinq.Async/SuperLinq.Async.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<RootNamespace>SuperLinq.Async</RootNamespace>

<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>

<EnablePackageValidation>true</EnablePackageValidation>
<PackageValidationBaselineVersion>6.0.0</PackageValidationBaselineVersion>
</PropertyGroup>

<PropertyGroup Label="Nuget">
Expand Down Expand Up @@ -104,8 +107,6 @@

<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath="\" />
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />
</ItemGroup>

<ItemGroup>
Expand All @@ -116,7 +117,6 @@
<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds" PrivateAssets="All" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="All" />
<PackageReference Include="MinVer" PrivateAssets="All" />
<PackageReference Include="System.Linq.Async" />
<PackageReference Include="System.Memory" />
Expand Down
95 changes: 95 additions & 0 deletions Source/SuperLinq/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{``0,``1}},System.Collections.Generic.IEqualityComparer{``0})</Target>
<Left>lib/net6.0/SuperLinq.dll</Left>
<Right>lib/net8.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{``0,``1}})</Target>
<Left>lib/net6.0/SuperLinq.dll</Left>
<Right>lib/net8.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.ValueTuple{``0,``1}},System.Collections.Generic.IEqualityComparer{``0})</Target>
<Left>lib/net6.0/SuperLinq.dll</Left>
<Right>lib/net8.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.ToDictionary``2(System.Collections.Generic.IEnumerable{System.ValueTuple{``0,``1}})</Target>
<Left>lib/net6.0/SuperLinq.dll</Left>
<Right>lib/net8.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<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>
<Left>lib/net8.0/SuperLinq.dll</Left>
<Right>lib/net9.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<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>
<Left>lib/net8.0/SuperLinq.dll</Left>
<Right>lib/net9.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.CountBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IEqualityComparer{``1})</Target>
<Left>lib/net8.0/SuperLinq.dll</Left>
<Right>lib/net9.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.CountBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1})</Target>
<Left>lib/net8.0/SuperLinq.dll</Left>
<Right>lib/net9.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.Index``1(System.Collections.Generic.IEnumerable{``0})</Target>
<Left>lib/net8.0/SuperLinq.dll</Left>
<Right>lib/net9.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.DistinctBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IEqualityComparer{``1})</Target>
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
<Right>lib/net6.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.DistinctBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1})</Target>
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
<Right>lib/net6.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.ElementAt``1(System.Collections.Generic.IEnumerable{``0},System.Index)</Target>
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
<Right>lib/net6.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.ElementAtOrDefault``1(System.Collections.Generic.IEnumerable{``0},System.Index)</Target>
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
<Right>lib/net6.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:SuperLinq.SuperEnumerable.Take``1(System.Collections.Generic.IEnumerable{``0},System.Range)</Target>
<Left>lib/netcoreapp3.1/SuperLinq.dll</Left>
<Right>lib/net6.0/SuperLinq.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0008</DiagnosticId>
<Target>T:SuperLinq.OrderByDirection</Target>
<Left>lib/net7.0/SuperLinq.dll</Left>
<Right>lib/net6.0/SuperLinq.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@

#if !NET7_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace System.Diagnostics;

#if !NET7_0_OR_GREATER
/// <summary>
/// Exception thrown when the program executes an instruction that was thought to be unreachable.
/// </summary>
Expand Down Expand Up @@ -43,4 +41,8 @@ public UnreachableException(string? message, Exception? innerException)
: base(message, innerException)
{ }
}
#else
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.Diagnostics.UnreachableException))]
#endif
7 changes: 4 additions & 3 deletions Source/SuperLinq/Join.MergeJoin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,10 @@
) : IEqualityComparer<TKey>
{
public bool Equals([AllowNull] TKey x, [AllowNull] TKey y) => comparer.Compare(x!, y!) == 0;
public int GetHashCode(
#if NETCOREAPP
public int GetHashCode([DisallowNull] TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
#else
public int GetHashCode(TKey obj) => ThrowHelper.ThrowNotSupportedException<int>();
[DisallowNull]
#endif
TKey obj
) => ThrowHelper.ThrowNotSupportedException<int>();

Check warning on line 734 in Source/SuperLinq/Join.MergeJoin.cs

View check run for this annotation

Codecov / codecov/patch

Source/SuperLinq/Join.MergeJoin.cs#L734

Added line #L734 was not covered by tests
}
Loading
Loading