Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Revert "Simplify IsValueType type check"
Browse files Browse the repository at this point in the history
This property doesn't compile on all configurations in the PR build
validation.
  • Loading branch information
AArnott committed Jul 1, 2017
1 parent f53617a commit cbb939e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Expand Up @@ -16,6 +16,21 @@ namespace System.Collections.Immutable
/// </summary>
internal static partial class ImmutableExtensions
{
internal static bool IsValueType<T>()
{
if (default(T) != null)
{
return true;
}

Type t = typeof(T);
if (t.IsConstructedGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))
{
return true;
}

return false;
}

#if EqualsStructurally

Expand Down
Expand Up @@ -221,7 +221,7 @@ public ImmutableHashSet<T> Remove(T item)
/// <param name="actualValue">The value from the set that the search found, or the original value if the search yielded no match.</param>
/// <returns>A value indicating whether the search was successful.</returns>
/// <remarks>
/// This can be useful when you want to reuse a previously stored reference instead of
/// This can be useful when you want to reuse a previously stored reference instead of
/// a newly constructed one (so that more sharing of references can occur) or to look up
/// a value that has more complete data than the value you currently have, although their
/// comparer functions indicate they are equal.
Expand Down Expand Up @@ -1014,7 +1014,7 @@ private static ImmutableHashSet<T> Wrap(SortedInt32KeyNode<HashBucket> root, IEq
/// <returns>The equality comparer to use.</returns>
private static IEqualityComparer<HashBucket> GetHashBucketEqualityComparer(IEqualityComparer<T> valueComparer)
{
if (!typeof(T).IsValueType)
if (!ImmutableExtensions.IsValueType<T>())
{
return HashBucketByRefEqualityComparer.DefaultInstance;
}
Expand Down

0 comments on commit cbb939e

Please sign in to comment.