Skip to content

Commit 1151955

Browse files
committed
use target typed new
small steps to see when it breaks
1 parent 65c8ae8 commit 1151955

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

ValidCode/Recursion/InstanceMapRepro/InstanceMap.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace ValidCode.Recursion.InstanceMapRepro;
1010
internal class InstanceMap<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
1111
where TKey : class
1212
{
13-
private readonly Dictionary<Maybe<TKey>, TValue> inner = new Dictionary<Maybe<TKey>, TValue>(KeyComparer.Default);
13+
private readonly Dictionary<Maybe<TKey>, TValue> inner = new(KeyComparer.Default);
1414

1515
#pragma warning disable INPC017 // Backing field name must match.
1616
internal object Gate => this.inner;
@@ -59,14 +59,15 @@ internal bool ContainsKey(TKey key)
5959

6060
private sealed class KeyComparer : IEqualityComparer<Maybe<TKey>>
6161
{
62-
internal static readonly KeyComparer Default = new KeyComparer();
62+
internal static readonly KeyComparer Default = new();
6363

6464
private KeyComparer()
6565
{
6666
}
6767

68-
public bool Equals(Maybe<TKey> x, Maybe<TKey> y) => x.HasValue == y.HasValue &&
69-
ReferenceEquals(x.Value, y.Value);
68+
public bool Equals(Maybe<TKey> x, Maybe<TKey> y) =>
69+
x.HasValue == y.HasValue &&
70+
ReferenceEquals(x.Value, y.Value);
7071

7172
public int GetHashCode(Maybe<TKey> obj)
7273
{

ValidCode/Recursion/InstanceMapRepro/Maybe.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public T Value
5858
/// <summary>
5959
/// Create an instance with a value.
6060
/// </summary>
61-
public static Maybe<T> Some(T value) => new Maybe<T>(hasValue: true, value: value);
61+
public static Maybe<T> Some(T value) => new(hasValue: true, value: value);
6262
#pragma warning restore CA1000 // Do not declare static members on generic types
6363

6464
/// <inheritdoc />

0 commit comments

Comments
 (0)