Remove leftover comparer extensions
このコミットが含まれているのは:
1 親
87f2e04ca0
コミット
2e21e02fc6
2ファイル変更
-324
検索条件に一致するファイルはありません
@@ -15,7 +15,6 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Extensions\HashCodeExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Extensions\IEqualityComparerExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ImmutableArrayExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Extensions\IncrementalValuesProviderExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ISymbolExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Helpers\Comparer{T,TSelf}.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Helpers\HashCode.cs" />
|
||||
|
||||
@@ -1,323 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace ComputeSharp.SourceGeneration.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="IncrementalValuesProvider{TValues}"/>.
|
||||
/// </summary>
|
||||
internal static class IncrementalValuesProviderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="IncrementalValuesProvider{TValues}"/> instance with a gven pair of comparers.
|
||||
/// </summary>
|
||||
/// <typeparam name="TLeft">The type of left items in each tuple.</typeparam>
|
||||
/// <typeparam name="TRight">The type of right items in each tuple.</typeparam>
|
||||
/// <param name="source">The input <see cref="IncrementalValuesProvider{TValues}"/> instance.</param>
|
||||
/// <param name="comparerLeft">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="TLeft"/> items.</param>
|
||||
/// <param name="comparerRight">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="TRight"/> items.</param>
|
||||
/// <returns>An <see cref="IncrementalValuesProvider{TValues}"/> with the specified comparers applied to each item.</returns>
|
||||
public static IncrementalValuesProvider<(TLeft Left, TRight Right)> WithComparers<TLeft, TRight>(
|
||||
this IncrementalValuesProvider<(TLeft Left, TRight Right)> source,
|
||||
IEqualityComparer<TLeft> comparerLeft,
|
||||
IEqualityComparer<TRight> comparerRight)
|
||||
{
|
||||
return source.WithComparer(new Comparer<TLeft, TRight>(comparerLeft, comparerRight));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="IncrementalValuesProvider{TValues}"/> instance with a gven pair of comparers.
|
||||
/// </summary>
|
||||
/// <typeparam name="T1">The type of first items in each tuple.</typeparam>
|
||||
/// <typeparam name="T2">The type of second items in each tuple.</typeparam>
|
||||
/// <typeparam name="T3">The type of third items in each tuple.</typeparam>
|
||||
/// <param name="source">The input <see cref="IncrementalValuesProvider{TValues}"/> instance.</param>
|
||||
/// <param name="comparer1">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T1"/> items.</param>
|
||||
/// <param name="comparer2">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T2"/> items.</param>
|
||||
/// <param name="comparer3">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T3"/> items.</param>
|
||||
/// <returns>An <see cref="IncrementalValuesProvider{TValues}"/> with the specified comparers applied to each item.</returns>
|
||||
public static IncrementalValuesProvider<(T1, T2, T3)> WithComparers<T1, T2, T3>(
|
||||
this IncrementalValuesProvider<(T1, T2, T3)> source,
|
||||
IEqualityComparer<T1> comparer1,
|
||||
IEqualityComparer<T2> comparer2,
|
||||
IEqualityComparer<T3> comparer3)
|
||||
{
|
||||
return source.WithComparer(new Comparer<T1, T2, T3>(comparer1, comparer2, comparer3));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="IncrementalValuesProvider{TValues}"/> instance with a gven pair of comparers.
|
||||
/// </summary>
|
||||
/// <typeparam name="T1">The type of first items in each tuple.</typeparam>
|
||||
/// <typeparam name="T2">The type of second items in each tuple.</typeparam>
|
||||
/// <typeparam name="T3">The type of third items in each tuple.</typeparam>
|
||||
/// <typeparam name="T4">The type of fourth items in each tuple.</typeparam>
|
||||
/// <param name="source">The input <see cref="IncrementalValuesProvider{TValues}"/> instance.</param>
|
||||
/// <param name="comparer1">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T1"/> items.</param>
|
||||
/// <param name="comparer2">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T2"/> items.</param>
|
||||
/// <param name="comparer3">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T3"/> items.</param>
|
||||
/// <param name="comparer4">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T4"/> items.</param>
|
||||
/// <returns>An <see cref="IncrementalValuesProvider{TValues}"/> with the specified comparers applied to each item.</returns>
|
||||
public static IncrementalValuesProvider<(T1, T2, T3, T4)> WithComparers<T1, T2, T3, T4>(
|
||||
this IncrementalValuesProvider<(T1, T2, T3, T4)> source,
|
||||
IEqualityComparer<T1> comparer1,
|
||||
IEqualityComparer<T2> comparer2,
|
||||
IEqualityComparer<T3> comparer3,
|
||||
IEqualityComparer<T4> comparer4)
|
||||
{
|
||||
return source.WithComparer(new Comparer<T1, T2, T3, T4>(comparer1, comparer2, comparer3, comparer4));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="IncrementalValuesProvider{TValues}"/> instance with a gven pair of comparers.
|
||||
/// </summary>
|
||||
/// <typeparam name="T1">The type of first items in each tuple.</typeparam>
|
||||
/// <typeparam name="T2">The type of second items in each tuple.</typeparam>
|
||||
/// <typeparam name="T3">The type of third items in each tuple.</typeparam>
|
||||
/// <typeparam name="T4">The type of fourth items in each tuple.</typeparam>
|
||||
/// <typeparam name="T5">The type of fourth items in each tuple.</typeparam>
|
||||
/// <param name="source">The input <see cref="IncrementalValuesProvider{TValues}"/> instance.</param>
|
||||
/// <param name="comparer1">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T1"/> items.</param>
|
||||
/// <param name="comparer2">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T2"/> items.</param>
|
||||
/// <param name="comparer3">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T3"/> items.</param>
|
||||
/// <param name="comparer4">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T4"/> items.</param>
|
||||
/// <param name="comparer5">An <see cref="IEqualityComparer{T}"/> instance for <typeparamref name="T5"/> items.</param>
|
||||
/// <returns>An <see cref="IncrementalValuesProvider{TValues}"/> with the specified comparers applied to each item.</returns>
|
||||
public static IncrementalValuesProvider<(T1, T2, T3, T4, T5)> WithComparers<T1, T2, T3, T4, T5>(
|
||||
this IncrementalValuesProvider<(T1, T2, T3, T4, T5)> source,
|
||||
IEqualityComparer<T1> comparer1,
|
||||
IEqualityComparer<T2> comparer2,
|
||||
IEqualityComparer<T3> comparer3,
|
||||
IEqualityComparer<T4> comparer4,
|
||||
IEqualityComparer<T5> comparer5)
|
||||
{
|
||||
return source.WithComparer(new Comparer<T1, T2, T3, T4, T5>(comparer1, comparer2, comparer3, comparer4, comparer5));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IEqualityComparer{T}"/> implementation for a value tuple.
|
||||
/// </summary>
|
||||
public sealed class Comparer<TLeft, TRight> : IEqualityComparer<(TLeft Left, TRight Right)>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <typeparamref name="TLeft"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<TLeft> comparerLeft;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="TRight"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<TRight> comparerRight;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Comparer{TLeft, TRight}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="comparerLeft">The <typeparamref name="TLeft"/> comparer.</param>
|
||||
/// <param name="comparerRight">The <typeparamref name="TRight"/> comparer.</param>
|
||||
public Comparer(IEqualityComparer<TLeft> comparerLeft, IEqualityComparer<TRight> comparerRight)
|
||||
{
|
||||
this.comparerLeft = comparerLeft;
|
||||
this.comparerRight = comparerRight;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals((TLeft Left, TRight Right) x, (TLeft Left, TRight Right) y)
|
||||
{
|
||||
return
|
||||
this.comparerLeft.Equals(x.Left, y.Left) &&
|
||||
this.comparerRight.Equals(x.Right, y.Right);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int GetHashCode((TLeft Left, TRight Right) obj)
|
||||
{
|
||||
return HashCode.Combine(
|
||||
this.comparerLeft.GetHashCode(obj.Left),
|
||||
this.comparerRight.GetHashCode(obj.Right));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IEqualityComparer{T}"/> implementation for a value tuple.
|
||||
/// </summary>
|
||||
public sealed class Comparer<T1, T2, T3> : IEqualityComparer<(T1, T2, T3)>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T1"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T1> comparer1;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T2"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T2> comparer2;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T3"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T3> comparer3;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Comparer{T1, T2, T3}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="comparer1">The <typeparamref name="T1"/> comparer.</param>
|
||||
/// <param name="comparer2">The <typeparamref name="T2"/> comparer.</param>
|
||||
/// <param name="comparer3">The <typeparamref name="T3"/> comparer.</param>
|
||||
public Comparer(IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3)
|
||||
{
|
||||
this.comparer1 = comparer1;
|
||||
this.comparer2 = comparer2;
|
||||
this.comparer3 = comparer3;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals((T1, T2, T3) x, (T1, T2, T3) y)
|
||||
{
|
||||
return
|
||||
this.comparer1.Equals(x.Item1, y.Item1) &&
|
||||
this.comparer2.Equals(x.Item2, y.Item2) &&
|
||||
this.comparer3.Equals(x.Item3, y.Item3);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int GetHashCode((T1, T2, T3) obj)
|
||||
{
|
||||
return HashCode.Combine(
|
||||
this.comparer1.GetHashCode(obj.Item1),
|
||||
this.comparer2.GetHashCode(obj.Item2),
|
||||
this.comparer3.GetHashCode(obj.Item3));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IEqualityComparer{T}"/> implementation for a value tuple.
|
||||
/// </summary>
|
||||
public sealed class Comparer<T1, T2, T3, T4> : IEqualityComparer<(T1, T2, T3, T4)>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T1"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T1> comparer1;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T2"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T2> comparer2;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T3"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T3> comparer3;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T4"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T4> comparer4;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Comparer{T1, T2, T3, T4}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="comparer1">The <typeparamref name="T1"/> comparer.</param>
|
||||
/// <param name="comparer2">The <typeparamref name="T2"/> comparer.</param>
|
||||
/// <param name="comparer3">The <typeparamref name="T3"/> comparer.</param>
|
||||
/// <param name="comparer4">The <typeparamref name="T4"/> comparer.</param>
|
||||
public Comparer(IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4)
|
||||
{
|
||||
this.comparer1 = comparer1;
|
||||
this.comparer2 = comparer2;
|
||||
this.comparer3 = comparer3;
|
||||
this.comparer4 = comparer4;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals((T1, T2, T3, T4) x, (T1, T2, T3, T4) y)
|
||||
{
|
||||
return
|
||||
this.comparer1.Equals(x.Item1, y.Item1) &&
|
||||
this.comparer2.Equals(x.Item2, y.Item2) &&
|
||||
this.comparer3.Equals(x.Item3, y.Item3) &&
|
||||
this.comparer4.Equals(x.Item4, y.Item4);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int GetHashCode((T1, T2, T3, T4) obj)
|
||||
{
|
||||
return HashCode.Combine(
|
||||
this.comparer1.GetHashCode(obj.Item1),
|
||||
this.comparer2.GetHashCode(obj.Item2),
|
||||
this.comparer3.GetHashCode(obj.Item3),
|
||||
this.comparer4.GetHashCode(obj.Item4));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IEqualityComparer{T}"/> implementation for a value tuple.
|
||||
/// </summary>
|
||||
public sealed class Comparer<T1, T2, T3, T4, T5> : IEqualityComparer<(T1, T2, T3, T4, T5)>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T1"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T1> comparer1;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T2"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T2> comparer2;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T3"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T3> comparer3;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T4"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T4> comparer4;
|
||||
|
||||
/// <summary>
|
||||
/// The <typeparamref name="T5"/> comparer.
|
||||
/// </summary>
|
||||
private readonly IEqualityComparer<T5> comparer5;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Comparer{T1, T2, T3, T4, T5}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="comparer1">The <typeparamref name="T1"/> comparer.</param>
|
||||
/// <param name="comparer2">The <typeparamref name="T2"/> comparer.</param>
|
||||
/// <param name="comparer3">The <typeparamref name="T3"/> comparer.</param>
|
||||
/// <param name="comparer4">The <typeparamref name="T4"/> comparer.</param>
|
||||
/// <param name="comparer5">The <typeparamref name="T5"/> comparer.</param>
|
||||
public Comparer(IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5)
|
||||
{
|
||||
this.comparer1 = comparer1;
|
||||
this.comparer2 = comparer2;
|
||||
this.comparer3 = comparer3;
|
||||
this.comparer4 = comparer4;
|
||||
this.comparer5 = comparer5;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals((T1, T2, T3, T4, T5) x, (T1, T2, T3, T4, T5) y)
|
||||
{
|
||||
return
|
||||
this.comparer1.Equals(x.Item1, y.Item1) &&
|
||||
this.comparer2.Equals(x.Item2, y.Item2) &&
|
||||
this.comparer3.Equals(x.Item3, y.Item3) &&
|
||||
this.comparer4.Equals(x.Item4, y.Item4) &&
|
||||
this.comparer5.Equals(x.Item5, y.Item5);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int GetHashCode((T1, T2, T3, T4, T5) obj)
|
||||
{
|
||||
return HashCode.Combine(
|
||||
this.comparer1.GetHashCode(obj.Item1),
|
||||
this.comparer2.GetHashCode(obj.Item2),
|
||||
this.comparer3.GetHashCode(obj.Item3),
|
||||
this.comparer4.GetHashCode(obj.Item4),
|
||||
this.comparer5.GetHashCode(obj.Item5));
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする