Skip to content

Commit b4161d5

Browse files
authored
Revert "Add params ReadOnlySpan<T> overloads (#100898)"
This reverts commit 64a937c.
1 parent ce6b092 commit b4161d5

File tree

80 files changed

+299
-1436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+299
-1436
lines changed

src/libraries/Common/tests/Tests/System/StringTests.cs

Lines changed: 29 additions & 172 deletions
Large diffs are not rendered by default.

src/libraries/System.Collections.Immutable/ref/System.Collections.Immutable.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public static partial class ImmutableArray
207207
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T item1, T item2, T item3, T item4) { throw null; }
208208
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(params T[]? items) { throw null; }
209209
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T[] items, int start, int length) { throw null; }
210-
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(params System.ReadOnlySpan<T> items) { throw null; }
210+
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(System.ReadOnlySpan<T> items) { throw null; }
211211
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(System.Span<T> items) { throw null; }
212212
public static System.Collections.Immutable.ImmutableArray<TSource> ToImmutableArray<TSource>(this System.Collections.Generic.IEnumerable<TSource> items) { throw null; }
213213
public static System.Collections.Immutable.ImmutableArray<TSource> ToImmutableArray<TSource>(this System.Collections.Immutable.ImmutableArray<TSource>.Builder builder) { throw null; }
@@ -244,7 +244,7 @@ public static partial class ImmutableArray
244244
public System.Collections.Immutable.ImmutableArray<T> AddRange<TDerived>(TDerived[] items) where TDerived : T { throw null; }
245245
public System.Collections.Immutable.ImmutableArray<T> AddRange(ImmutableArray<T> items, int length) { throw null; }
246246
public System.Collections.Immutable.ImmutableArray<T> AddRange<TDerived>(ImmutableArray<TDerived> items) where TDerived : T { throw null; }
247-
public System.Collections.Immutable.ImmutableArray<T> AddRange(params System.ReadOnlySpan<T> items) { throw null; }
247+
public System.Collections.Immutable.ImmutableArray<T> AddRange(System.ReadOnlySpan<T> items) { throw null; }
248248
public System.Collections.Immutable.ImmutableArray<T> AddRange(params T[] items) { throw null; }
249249
public System.ReadOnlyMemory<T> AsMemory() { throw null; }
250250
public System.ReadOnlySpan<T> AsSpan() { throw null; }
@@ -284,7 +284,7 @@ public void CopyTo(System.Span<T> destination) { }
284284
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, System.Collections.Generic.IEnumerable<T> items) { throw null; }
285285
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, System.Collections.Immutable.ImmutableArray<T> items) { throw null; }
286286
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, T[] items) { throw null; }
287-
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, params System.ReadOnlySpan<T> items) { throw null; }
287+
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, System.ReadOnlySpan<T> items) { throw null; }
288288
public ref readonly T ItemRef(int index) { throw null; }
289289
public int LastIndexOf(T item) { throw null; }
290290
public int LastIndexOf(T item, int startIndex) { throw null; }
@@ -362,8 +362,8 @@ public void AddRange(T[] items, int length) { }
362362
public void AddRange<TDerived>(System.Collections.Immutable.ImmutableArray<TDerived> items) where TDerived : T { }
363363
public void AddRange<TDerived>(System.Collections.Immutable.ImmutableArray<TDerived>.Builder items) where TDerived : T { }
364364
public void AddRange<TDerived>(TDerived[] items) where TDerived : T { }
365-
public void AddRange(params System.ReadOnlySpan<T> items) { }
366-
public void AddRange<TDerived>(params System.ReadOnlySpan<TDerived> items) where TDerived : T { }
365+
public void AddRange(System.ReadOnlySpan<T> items) { }
366+
public void AddRange<TDerived>(System.ReadOnlySpan<TDerived> items) where TDerived : T { }
367367
public void Clear() { }
368368
public bool Contains(T item) { throw null; }
369369
public void CopyTo(T[] array, int index) { }
@@ -562,10 +562,10 @@ public static partial class ImmutableHashSet
562562
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(System.Collections.Generic.IEqualityComparer<T>? equalityComparer) { throw null; }
563563
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(System.Collections.Generic.IEqualityComparer<T>? equalityComparer, T item) { throw null; }
564564
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(System.Collections.Generic.IEqualityComparer<T>? equalityComparer, params T[] items) { throw null; }
565-
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(System.Collections.Generic.IEqualityComparer<T>? equalityComparer, params System.ReadOnlySpan<T> items) { throw null; }
565+
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(System.Collections.Generic.IEqualityComparer<T>? equalityComparer, System.ReadOnlySpan<T> items) { throw null; }
566566
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(T item) { throw null; }
567567
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(params T[] items) { throw null; }
568-
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(params System.ReadOnlySpan<T> items) { throw null; }
568+
public static System.Collections.Immutable.ImmutableHashSet<T> Create<T>(System.ReadOnlySpan<T> items) { throw null; }
569569
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source) { throw null; }
570570
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, System.Collections.Generic.IEqualityComparer<TSource>? equalityComparer) { throw null; }
571571
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Immutable.ImmutableHashSet<TSource>.Builder builder) { throw null; }
@@ -691,7 +691,7 @@ public static partial class ImmutableList
691691
public static System.Collections.Immutable.ImmutableList<T> Create<T>() { throw null; }
692692
public static System.Collections.Immutable.ImmutableList<T> Create<T>(T item) { throw null; }
693693
public static System.Collections.Immutable.ImmutableList<T> Create<T>(params T[] items) { throw null; }
694-
public static System.Collections.Immutable.ImmutableList<T> Create<T>(params System.ReadOnlySpan<T> items) { throw null; }
694+
public static System.Collections.Immutable.ImmutableList<T> Create<T>(System.ReadOnlySpan<T> items) { throw null; }
695695
public static int IndexOf<T>(this System.Collections.Immutable.IImmutableList<T> list, T item) { throw null; }
696696
public static int IndexOf<T>(this System.Collections.Immutable.IImmutableList<T> list, T item, System.Collections.Generic.IEqualityComparer<T>? equalityComparer) { throw null; }
697697
public static int IndexOf<T>(this System.Collections.Immutable.IImmutableList<T> list, T item, int startIndex) { throw null; }
@@ -887,7 +887,7 @@ public static partial class ImmutableQueue
887887
public static System.Collections.Immutable.ImmutableQueue<T> Create<T>() { throw null; }
888888
public static System.Collections.Immutable.ImmutableQueue<T> Create<T>(T item) { throw null; }
889889
public static System.Collections.Immutable.ImmutableQueue<T> Create<T>(params T[] items) { throw null; }
890-
public static System.Collections.Immutable.ImmutableQueue<T> Create<T>(params System.ReadOnlySpan<T> items) { throw null; }
890+
public static System.Collections.Immutable.ImmutableQueue<T> Create<T>(System.ReadOnlySpan<T> items) { throw null; }
891891
public static System.Collections.Immutable.IImmutableQueue<T> Dequeue<T>(this System.Collections.Immutable.IImmutableQueue<T> queue, out T value) { throw null; }
892892
}
893893
[System.Runtime.CompilerServices.CollectionBuilderAttribute(typeof(System.Collections.Immutable.ImmutableQueue), "Create")]
@@ -1063,10 +1063,10 @@ public static partial class ImmutableSortedSet
10631063
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(System.Collections.Generic.IComparer<T>? comparer) { throw null; }
10641064
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(System.Collections.Generic.IComparer<T>? comparer, T item) { throw null; }
10651065
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(System.Collections.Generic.IComparer<T>? comparer, params T[] items) { throw null; }
1066-
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(System.Collections.Generic.IComparer<T>? comparer, params System.ReadOnlySpan<T> items) { throw null; }
1066+
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(System.Collections.Generic.IComparer<T>? comparer, System.ReadOnlySpan<T> items) { throw null; }
10671067
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(T item) { throw null; }
10681068
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(params T[] items) { throw null; }
1069-
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(params System.ReadOnlySpan<T> items) { throw null; }
1069+
public static System.Collections.Immutable.ImmutableSortedSet<T> Create<T>(System.ReadOnlySpan<T> items) { throw null; }
10701070
public static System.Collections.Immutable.ImmutableSortedSet<TSource> ToImmutableSortedSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source) { throw null; }
10711071
public static System.Collections.Immutable.ImmutableSortedSet<TSource> ToImmutableSortedSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, System.Collections.Generic.IComparer<TSource>? comparer) { throw null; }
10721072
public static System.Collections.Immutable.ImmutableSortedSet<TSource> ToImmutableSortedSet<TSource>(this System.Collections.Immutable.ImmutableSortedSet<TSource>.Builder builder) { throw null; }
@@ -1198,7 +1198,7 @@ public static partial class ImmutableStack
11981198
public static System.Collections.Immutable.ImmutableStack<T> Create<T>() { throw null; }
11991199
public static System.Collections.Immutable.ImmutableStack<T> Create<T>(T item) { throw null; }
12001200
public static System.Collections.Immutable.ImmutableStack<T> Create<T>(params T[] items) { throw null; }
1201-
public static System.Collections.Immutable.ImmutableStack<T> Create<T>(params System.ReadOnlySpan<T> items) { throw null; }
1201+
public static System.Collections.Immutable.ImmutableStack<T> Create<T>(System.ReadOnlySpan<T> items) { throw null; }
12021202
public static System.Collections.Immutable.IImmutableStack<T> Pop<T>(this System.Collections.Immutable.IImmutableStack<T> stack, out T value) { throw null; }
12031203
}
12041204
[System.Runtime.CompilerServices.CollectionBuilderAttribute(typeof(System.Collections.Immutable.ImmutableStack), "Create")]

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static ImmutableArray<T> Create<T>(T item1, T item2, T item3, T item4)
8787
/// <typeparam name="T">The type of element stored in the array.</typeparam>
8888
/// <param name="items">The elements to store in the array.</param>
8989
/// <returns>An immutable array containing the specified items.</returns>
90-
public static ImmutableArray<T> Create<T>(params ReadOnlySpan<T> items)
90+
public static ImmutableArray<T> Create<T>(ReadOnlySpan<T> items)
9191
{
9292
if (items.IsEmpty)
9393
{

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public void AddRange(ImmutableArray<T> items, int length)
430430
/// Adds the specified items to the end of the array.
431431
/// </summary>
432432
/// <param name="items">The items to add at the end of the array.</param>
433-
public void AddRange(params ReadOnlySpan<T> items)
433+
public void AddRange(ReadOnlySpan<T> items)
434434
{
435435
int offset = this.Count;
436436
this.Count += items.Length;
@@ -443,7 +443,7 @@ public void AddRange(params ReadOnlySpan<T> items)
443443
/// </summary>
444444
/// <typeparam name="TDerived">The type that derives from the type of item already in the array.</typeparam>
445445
/// <param name="items">The items to add at the end of the array.</param>
446-
public void AddRange<TDerived>(params ReadOnlySpan<TDerived> items) where TDerived : T
446+
public void AddRange<TDerived>(ReadOnlySpan<TDerived> items) where TDerived : T
447447
{
448448
int offset = this.Count;
449449
this.Count += items.Length;

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ public IEnumerable<TResult> OfType<TResult>()
880880
/// </summary>
881881
/// <param name="items">The values to add.</param>
882882
/// <returns>A new list with the elements added.</returns>
883-
public ImmutableArray<T> AddRange(params ReadOnlySpan<T> items)
883+
public ImmutableArray<T> AddRange(ReadOnlySpan<T> items)
884884
{
885885
ImmutableArray<T> self = this;
886886
return self.InsertRange(self.Length, items);
@@ -949,7 +949,7 @@ public ImmutableArray<T> InsertRange(int index, T[] items)
949949
/// <param name="index">The index at which to insert the value.</param>
950950
/// <param name="items">The elements to insert.</param>
951951
/// <returns>The new immutable collection.</returns>
952-
public ImmutableArray<T> InsertRange(int index, params ReadOnlySpan<T> items)
952+
public ImmutableArray<T> InsertRange(int index, ReadOnlySpan<T> items)
953953
{
954954
ImmutableArray<T> self = this;
955955
self.ThrowNullRefIfNotInitialized();

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static ImmutableHashSet<T> Create<T>(params T[] items)
9898
/// <typeparam name="T">The type of items stored by the collection.</typeparam>
9999
/// <param name="items">The items to prepopulate.</param>
100100
/// <returns>The new immutable collection.</returns>
101-
public static ImmutableHashSet<T> Create<T>(params ReadOnlySpan<T> items)
101+
public static ImmutableHashSet<T> Create<T>(ReadOnlySpan<T> items)
102102
{
103103
return ImmutableHashSet<T>.Empty.Union(items);
104104
}
@@ -124,7 +124,7 @@ public static ImmutableHashSet<T> Create<T>(IEqualityComparer<T>? equalityCompar
124124
/// <param name="equalityComparer">The equality comparer.</param>
125125
/// <param name="items">The items to prepopulate.</param>
126126
/// <returns>The new immutable collection.</returns>
127-
public static ImmutableHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer, params ReadOnlySpan<T> items)
127+
public static ImmutableHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer, ReadOnlySpan<T> items)
128128
{
129129
return ImmutableHashSet<T>.Empty.WithComparer(equalityComparer).Union(items);
130130
}

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static ImmutableList<T> Create<T>(params T[] items)
5252
/// <typeparam name="T">The type of items stored by the collection.</typeparam>
5353
/// <param name="items">A span that contains the items to prepopulate the list with.</param>
5454
/// <returns>A new immutable list that contains the specified items.</returns>
55-
public static ImmutableList<T> Create<T>(params ReadOnlySpan<T> items) => ImmutableList<T>.Empty.AddRange(items);
55+
public static ImmutableList<T> Create<T>(ReadOnlySpan<T> items) => ImmutableList<T>.Empty.AddRange(items);
5656

5757
/// <summary>
5858
/// Creates a new immutable list builder.

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableQueue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static ImmutableQueue<T> Create<T>(params T[] items)
8383
/// <typeparam name="T">The type of items in the immutable queue.</typeparam>
8484
/// <param name="items">A span that contains the items to prepopulate the queue with.</param>
8585
/// <returns>A new immutable queue that contains the specified items.</returns>
86-
public static ImmutableQueue<T> Create<T>(params ReadOnlySpan<T> items)
86+
public static ImmutableQueue<T> Create<T>(ReadOnlySpan<T> items)
8787
{
8888
if (items.IsEmpty)
8989
{

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static ImmutableSortedSet<T> Create<T>(params T[] items)
9797
/// <typeparam name="T">The type of items in the immutable set.</typeparam>
9898
/// <param name="items">A span that contains the items to prepopulate the set with.</param>
9999
/// <returns>A new immutable set that contains the specified items.</returns>
100-
public static ImmutableSortedSet<T> Create<T>(params ReadOnlySpan<T> items)
100+
public static ImmutableSortedSet<T> Create<T>(ReadOnlySpan<T> items)
101101
{
102102
return ImmutableSortedSet<T>.Empty.Union(items);
103103
}
@@ -123,7 +123,7 @@ public static ImmutableSortedSet<T> Create<T>(IComparer<T>? comparer, params T[]
123123
/// <param name="comparer">The comparer.</param>
124124
/// <param name="items">The items to prepopulate.</param>
125125
/// <returns>The new immutable collection.</returns>
126-
public static ImmutableSortedSet<T> Create<T>(IComparer<T>? comparer, params ReadOnlySpan<T> items)
126+
public static ImmutableSortedSet<T> Create<T>(IComparer<T>? comparer, ReadOnlySpan<T> items)
127127
{
128128
return ImmutableSortedSet<T>.Empty.WithComparer(comparer).Union(items);
129129
}

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableStack.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static ImmutableStack<T> Create<T>(params T[] items)
7070
/// <typeparam name="T">The type of items in the immutable stack.</typeparam>
7171
/// <param name="items">A span that contains the items to prepopulate the stack with.</param>
7272
/// <returns>A new immutable stack that contains the specified items.</returns>
73-
public static ImmutableStack<T> Create<T>(params ReadOnlySpan<T> items)
73+
public static ImmutableStack<T> Create<T>(ReadOnlySpan<T> items)
7474
{
7575
ImmutableStack<T> stack = ImmutableStack<T>.Empty;
7676
foreach (T item in items)

src/libraries/System.Collections.Immutable/tests/ImmutableHashSetTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ public void Create()
118118
Assert.Equal(1, set.Count);
119119
Assert.Same(comparer, set.KeyComparer);
120120

121-
set = ImmutableHashSet.Create(new[] { "a", "b" });
121+
set = ImmutableHashSet.Create("a", "b");
122122
Assert.Equal(2, set.Count);
123123
Assert.Same(EqualityComparer<string>.Default, set.KeyComparer);
124124

125125
set = ImmutableHashSet.Create((ReadOnlySpan<string>)new[] { "a", "b" });
126126
Assert.Equal(2, set.Count);
127127
Assert.Same(EqualityComparer<string>.Default, set.KeyComparer);
128128

129-
set = ImmutableHashSet.Create(comparer, new[] { "a", "b" });
129+
set = ImmutableHashSet.Create(comparer, "a", "b");
130130
Assert.Equal(2, set.Count);
131131
Assert.Same(comparer, set.KeyComparer);
132132

src/libraries/System.Collections.Immutable/tests/ImmutableListTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ public void Create()
584584
list = ImmutableList.Create("a");
585585
Assert.Equal(1, list.Count);
586586

587-
list = ImmutableList.Create(new[] { "a", "b" });
587+
list = ImmutableList.Create("a", "b");
588588
Assert.Equal(2, list.Count);
589589

590590
list = ImmutableList.Create((ReadOnlySpan<string>)new[] { "a", "b" });

src/libraries/System.Collections.Immutable/tests/ImmutableQueueTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public void Create()
213213
Assert.False(queue.IsEmpty);
214214
Assert.Equal(new[] { 1 }, queue);
215215

216-
queue = ImmutableQueue.Create(new int[] { 1, 2 });
216+
queue = ImmutableQueue.Create(1, 2);
217217
Assert.False(queue.IsEmpty);
218218
Assert.Equal(new[] { 1, 2 }, queue);
219219

src/libraries/System.Collections.Immutable/tests/ImmutableSortedSetTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ public void Create()
289289
Assert.Equal(1, set.Count);
290290
Assert.Same(comparer, set.KeyComparer);
291291

292-
set = ImmutableSortedSet.Create(new [] { "a", "b" });
292+
set = ImmutableSortedSet.Create("a", "b");
293293
Assert.Equal(2, set.Count);
294294
Assert.Same(Comparer<string>.Default, set.KeyComparer);
295295

296296
set = ImmutableSortedSet.Create((ReadOnlySpan<string>)new[] { "a", "b" });
297297
Assert.Equal(2, set.Count);
298298
Assert.Same(Comparer<string>.Default, set.KeyComparer);
299299

300-
set = ImmutableSortedSet.Create(comparer, new[] { "a", "b" });
300+
set = ImmutableSortedSet.Create(comparer, "a", "b");
301301
Assert.Equal(2, set.Count);
302302
Assert.Same(comparer, set.KeyComparer);
303303

0 commit comments

Comments
 (0)