Skip to content

Commit c95029d

Browse files
committed
More analyzer fixes
1 parent 0f39ec5 commit c95029d

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

src/ILLink.Shared/DataFlow/DefaultValueDictionary.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,8 @@ public DefaultValueDictionary<TKey, TValue> Clone ()
108108
// Prevent warning CS0659 https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0659.
109109
// This type should never be used as a dictionary key.
110110
public override int GetHashCode () => throw new NotImplementedException ();
111+
112+
public static bool operator ==(DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => left.Equals(right);
113+
public static bool operator !=(DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => !(left == right);
111114
}
112115
}

src/ILLink.Shared/DataFlow/MaybeLattice.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public Maybe<T> Clone ()
2626
return new (copyValue.DeepCopy ());
2727
return new (value);
2828
}
29+
30+
public static bool operator ==(Maybe<T> left, Maybe<T> right) => left.Equals(right);
31+
public static bool operator !=(Maybe<T> left, Maybe<T> right) => !(left == right);
2932
}
3033

3134
public struct MaybeLattice<T, TValueLattice> : ILattice<Maybe<T>>

src/ILLink.Shared/TypeSystemProxy/WellKnownType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public static (string Namespace, string Name) GetNamespaceAndName (this WellKnow
3838
WellKnownType.System_NotSupportedException => ("System", "NotSupportedException"),
3939
WellKnownType.System_Runtime_CompilerServices_DisablePrivateReflectionAttribute => ("System.Runtime.CompilerServices", "DisablePrivateReflectionAttribute"),
4040
WellKnownType.System_Void => ("System", "Void"),
41+
_ => throw new System.ArgumentException (type)
4142
};
4243
}
4344
public static string GetNamespace (this WellKnownType type) => GetNamespaceAndName (type).Namespace;

src/linker/Linker.Dataflow/ValueNode.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,8 @@ public ValueBasicBlockPair (MultiValue value, int basicBlockIndex)
6464
public override bool Equals (object? obj) => obj is ValueBasicBlockPair other && Equals (other);
6565

6666
public override int GetHashCode () => HashUtils.Combine (Value.GetHashCode (), BasicBlockIndex);
67+
68+
public static bool operator ==(ValueBasicBlockPair left, ValueBasicBlockPair right) => left.Equals(right);
69+
public static bool operator !=(ValueBasicBlockPair left, ValueBasicBlockPair right) => !(left == right);
6770
}
6871
}

0 commit comments

Comments
 (0)