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

Remove Pure attribute from System.Collections.Immutable #35118

Merged
merged 2 commits into from
Apr 27, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<StrongNameKeyId>Microsoft</StrongNameKeyId>
<IsNETCoreApp>true</IsNETCoreApp>
</PropertyGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static partial class ImmutableArray
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T item1, T item2) { throw null; }
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T item1, T item2, T item3) { throw null; }
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T item1, T item2, T item3, T item4) { throw null; }
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(params T[] items) { throw null; }
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(params T[]? items) { throw null; }
ericstj marked this conversation as resolved.
Show resolved Hide resolved
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T[] items, int start, int length) { throw null; }
public static System.Collections.Immutable.ImmutableArray<TSource> ToImmutableArray<TSource>(this System.Collections.Generic.IEnumerable<TSource> items) { throw null; }
public static System.Collections.Immutable.ImmutableArray<TSource> ToImmutableArray<TSource>(this System.Collections.Immutable.ImmutableArray<TSource>.Builder builder) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;

namespace System.Collections.Immutable
{
Expand All @@ -18,7 +17,6 @@ public interface IImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey,
/// <summary>
/// Gets an empty dictionary with equivalent ordering and key/value comparison rules.
/// </summary>
[Pure]
IImmutableDictionary<TKey, TValue> Clear();

/// <summary>
Expand All @@ -31,7 +29,6 @@ public interface IImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey,
/// <remarks>
/// If the given key-value pair are already in the dictionary, the existing instance is returned.
/// </remarks>
[Pure]
IImmutableDictionary<TKey, TValue> Add(TKey key, TValue value);

/// <summary>
Expand All @@ -40,7 +37,6 @@ public interface IImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey,
/// <param name="pairs">The pairs.</param>
/// <returns>The new dictionary containing the additional key-value pairs.</returns>
/// <exception cref="ArgumentException">Thrown when one of the given keys already exists in the dictionary but has a different value.</exception>
[Pure]
IImmutableDictionary<TKey, TValue> AddRange(IEnumerable<KeyValuePair<TKey, TValue>> pairs);

/// <summary>
Expand All @@ -53,31 +49,27 @@ public interface IImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey,
/// If the given key-value pair are already in the dictionary, the existing instance is returned.
/// If the key already exists but with a different value, a new instance with the overwritten value will be returned.
/// </remarks>
[Pure]
IImmutableDictionary<TKey, TValue> SetItem(TKey key, TValue value);

/// <summary>
/// Applies a given set of key=value pairs to an immutable dictionary, replacing any conflicting keys in the resulting dictionary.
/// </summary>
/// <param name="items">The key=value pairs to set on the dictionary. Any keys that conflict with existing keys will overwrite the previous values.</param>
/// <returns>An immutable dictionary.</returns>
[Pure]
IImmutableDictionary<TKey, TValue> SetItems(IEnumerable<KeyValuePair<TKey, TValue>> items);

/// <summary>
/// Removes the specified keys from the dictionary with their associated values.
/// </summary>
/// <param name="keys">The keys to remove.</param>
/// <returns>A new dictionary with those keys removed; or this instance if those keys are not in the dictionary.</returns>
[Pure]
IImmutableDictionary<TKey, TValue> RemoveRange(IEnumerable<TKey> keys);

/// <summary>
/// Removes the specified key from the dictionary with its associated value.
/// </summary>
/// <param name="key">The key to remove.</param>
/// <returns>A new dictionary with the matching entry removed; or this instance if the key is not in the dictionary.</returns>
[Pure]
IImmutableDictionary<TKey, TValue> Remove(TKey key);

/// <summary>
Expand All @@ -87,7 +79,6 @@ public interface IImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey,
/// <returns>
/// <c>true</c> if this dictionary contains the key-value pair; otherwise, <c>false</c>.
/// </returns>
[Pure]
bool Contains(KeyValuePair<TKey, TValue> pair);

/// <summary>
Expand All @@ -102,7 +93,6 @@ public interface IImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey,
/// the canonical value, or a value that has more complete data than the value you currently have,
/// although their comparer functions indicate they are equal.
/// </remarks>
[Pure]
bool TryGetKey(TKey equalKey, out TKey actualKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;

namespace System.Collections.Immutable
{
Expand All @@ -21,7 +20,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// <summary>
/// Gets an empty list that retains the same sort semantics that this instance has.
/// </summary>
[Pure]
IImmutableList<T> Clear();

/// <summary>
Expand Down Expand Up @@ -49,7 +47,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// elements in the <see cref="ImmutableList{T}"/> that starts at index and
/// contains count number of elements, if found; otherwise, -1.
/// </returns>
[Pure]
int IndexOf(T item, int index, int count, IEqualityComparer<T>? equalityComparer);

/// <summary>
Expand All @@ -73,23 +70,20 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// in the <see cref="ImmutableList{T}"/> that contains <paramref name="count"/> number of elements
/// and ends at <paramref name="index"/>, if found; otherwise, -1.
/// </returns>
[Pure]
int LastIndexOf(T item, int index, int count, IEqualityComparer<T>? equalityComparer);

/// <summary>
/// Adds the specified value to this list.
/// </summary>
/// <param name="value">The value to add.</param>
/// <returns>A new list with the element added.</returns>
[Pure]
IImmutableList<T> Add(T value);

/// <summary>
/// Adds the specified values to this list.
/// </summary>
/// <param name="items">The values to add.</param>
/// <returns>A new list with the elements added.</returns>
[Pure]
IImmutableList<T> AddRange(IEnumerable<T> items);

/// <summary>
Expand All @@ -98,7 +92,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// <param name="index">The index at which to insert the value.</param>
/// <param name="element">The element to insert.</param>
/// <returns>The new immutable list.</returns>
[Pure]
IImmutableList<T> Insert(int index, T element);

/// <summary>
Expand All @@ -107,7 +100,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// <param name="index">The index at which to insert the value.</param>
/// <param name="items">The elements to insert.</param>
/// <returns>The new immutable list.</returns>
[Pure]
IImmutableList<T> InsertRange(int index, IEnumerable<T> items);

/// <summary>
Expand All @@ -119,7 +111,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used.
/// </param>
/// <returns>A new list with the element removed, or this list if the element is not in this list.</returns>
[Pure]
IImmutableList<T> Remove(T value, IEqualityComparer<T>? equalityComparer);

/// <summary>
Expand All @@ -133,7 +124,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// <returns>
/// The new list.
/// </returns>
[Pure]
IImmutableList<T> RemoveAll(Predicate<T> match);

/// <summary>
Expand All @@ -147,7 +137,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// <returns>
/// A new list with the elements removed.
/// </returns>
[Pure]
IImmutableList<T> RemoveRange(IEnumerable<T> items, IEqualityComparer<T>? equalityComparer);

/// <summary>
Expand All @@ -158,15 +147,13 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// <returns>
/// A new list with the elements removed.
/// </returns>
[Pure]
IImmutableList<T> RemoveRange(int index, int count);

/// <summary>
/// Removes the element at the specified index.
/// </summary>
/// <param name="index">The index.</param>
/// <returns>A new list with the elements removed.</returns>
[Pure]
IImmutableList<T> RemoveAt(int index);

/// <summary>
Expand All @@ -175,7 +162,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// <param name="index">The position in the list of the element to replace.</param>
/// <param name="value">The element to replace the old element with.</param>
/// <returns>The new list -- even if the value being replaced is equal to the new value for that position.</returns>
[Pure]
IImmutableList<T> SetItem(int index, T value);

/// <summary>
Expand All @@ -189,7 +175,6 @@ public interface IImmutableList<T> : IReadOnlyList<T>
/// </param>
/// <returns>The new list -- even if the value being replaced is equal to the new value for that position.</returns>
/// <exception cref="ArgumentException">Thrown when the old value does not exist in the list.</exception>
[Pure]
IImmutableList<T> Replace(T oldValue, T newValue, IEqualityComparer<T>? equalityComparer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;

namespace System.Collections.Immutable
{
Expand All @@ -20,13 +19,11 @@ public interface IImmutableQueue<T> : IEnumerable<T>
/// <value>
/// <c>true</c> if this queue is empty; otherwise, <c>false</c>.
/// </value>
[Pure]
bool IsEmpty { get; }

/// <summary>
/// Gets an empty queue.
/// </summary>
[Pure]
IImmutableQueue<T> Clear();

/// <summary>
Expand All @@ -36,7 +33,6 @@ public interface IImmutableQueue<T> : IEnumerable<T>
/// The element at the front of the queue.
/// </returns>
/// <exception cref="InvalidOperationException">Thrown when the queue is empty.</exception>
[Pure]
T Peek();

/// <summary>
Expand All @@ -46,15 +42,13 @@ public interface IImmutableQueue<T> : IEnumerable<T>
/// <returns>
/// The new queue.
/// </returns>
[Pure]
IImmutableQueue<T> Enqueue(T value);

/// <summary>
/// Returns a queue that is missing the front element.
/// </summary>
/// <returns>A queue; never <c>null</c>.</returns>
/// <exception cref="InvalidOperationException">Thrown when the queue is empty.</exception>
[Pure]
IImmutableQueue<T> Dequeue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;

namespace System.Collections.Immutable
{
Expand All @@ -21,7 +20,6 @@ public interface IImmutableSet<T> : IReadOnlyCollection<T>
/// <summary>
/// Gets an empty set that retains the same sort or unordered semantics that this instance has.
/// </summary>
[Pure]
IImmutableSet<T> Clear();

/// <summary>
Expand All @@ -31,23 +29,20 @@ public interface IImmutableSet<T> : IReadOnlyCollection<T>
/// <returns>
/// <c>true</c> if the set contains the specified value; otherwise, <c>false</c>.
/// </returns>
[Pure]
bool Contains(T value);

/// <summary>
/// Adds the specified value to this set.
/// </summary>
/// <param name="value">The value to add.</param>
/// <returns>A new set with the element added, or this set if the element is already in this set.</returns>
[Pure]
IImmutableSet<T> Add(T value);

/// <summary>
/// Removes the specified value from this set.
/// </summary>
/// <param name="value">The value to remove.</param>
/// <returns>A new set with the element removed, or this set if the element is not in this set.</returns>
[Pure]
IImmutableSet<T> Remove(T value);

/// <summary>
Expand All @@ -62,87 +57,76 @@ public interface IImmutableSet<T> : IReadOnlyCollection<T>
/// a value that has more complete data than the value you currently have, although their
/// comparer functions indicate they are equal.
/// </remarks>
[Pure]
bool TryGetValue(T equalValue, out T actualValue);

/// <summary>
/// Produces a set that contains elements that exist in both this set and the specified set.
/// </summary>
/// <param name="other">The set to intersect with this one.</param>
/// <returns>A new set that contains any elements that exist in both sets.</returns>
[Pure]
IImmutableSet<T> Intersect(IEnumerable<T> other);

/// <summary>
/// Removes a given set of items from this set.
/// </summary>
/// <param name="other">The items to remove from this set.</param>
/// <returns>The new set with the items removed; or the original set if none of the items were in the set.</returns>
[Pure]
IImmutableSet<T> Except(IEnumerable<T> other);

/// <summary>
/// Produces a set that contains elements either in this set or a given sequence, but not both.
/// </summary>
/// <param name="other">The other sequence of items.</param>
/// <returns>The new set.</returns>
[Pure]
IImmutableSet<T> SymmetricExcept(IEnumerable<T> other);

/// <summary>
/// Adds a given set of items to this set.
/// </summary>
/// <param name="other">The items to add.</param>
/// <returns>The new set with the items added; or the original set if all the items were already in the set.</returns>
[Pure]
IImmutableSet<T> Union(IEnumerable<T> other);

/// <summary>
/// Checks whether a given sequence of items entirely describe the contents of this set.
/// </summary>
/// <param name="other">The sequence of items to check against this set.</param>
/// <returns>A value indicating whether the sets are equal.</returns>
[Pure]
bool SetEquals(IEnumerable<T> other);

/// <summary>
/// Determines whether the current set is a proper (strict) subset of a specified collection.
/// </summary>
/// <param name="other">The collection to compare to the current set.</param>
/// <returns>true if the current set is a correct subset of other; otherwise, false.</returns>
[Pure]
bool IsProperSubsetOf(IEnumerable<T> other);

/// <summary>
/// Determines whether the current set is a proper superset of a specified collection.
/// </summary>
/// <param name="other">The collection to compare to the current set.</param>
/// <returns>true if the current set is a correct superset of other; otherwise, false.</returns>
[Pure]
bool IsProperSupersetOf(IEnumerable<T> other);

/// <summary>
/// Determines whether a set is a subset of a specified collection.
/// </summary>
/// <param name="other">The collection to compare to the current set.</param>
/// <returns>true if the current set is a subset of other; otherwise, false.</returns>
[Pure]
bool IsSubsetOf(IEnumerable<T> other);

/// <summary>
/// Determines whether the current set is a superset of a specified collection.
/// </summary>
/// <param name="other">The collection to compare to the current set.</param>
/// <returns>true if the current set is a superset of other; otherwise, false.</returns>
[Pure]
bool IsSupersetOf(IEnumerable<T> other);

/// <summary>
/// Determines whether the current set overlaps with the specified collection.
/// </summary>
/// <param name="other">The collection to compare to the current set.</param>
/// <returns>true if the current set and other share at least one common element; otherwise, false.</returns>
[Pure]
bool Overlaps(IEnumerable<T> other);
}
}
Loading