Skip to content

Commit

Permalink
More analyzer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Jan 17, 2023
1 parent 0f39ec5 commit 317c4a1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ILLink.Shared/DataFlow/DefaultValueDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,8 @@ public DefaultValueDictionary<TKey, TValue> Clone ()
// Prevent warning CS0659 https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0659.
// This type should never be used as a dictionary key.
public override int GetHashCode () => throw new NotImplementedException ();

public static bool operator ==(DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => left.Equals(right);
public static bool operator !=(DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => !(left == right);
}
}
3 changes: 3 additions & 0 deletions src/ILLink.Shared/DataFlow/MaybeLattice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public Maybe<T> Clone ()
return new (copyValue.DeepCopy ());
return new (value);
}

public static bool operator ==(Maybe<T> left, Maybe<T> right) => left.Equals(right);
public static bool operator !=(Maybe<T> left, Maybe<T> right) => !(left == right);
}

public struct MaybeLattice<T, TValueLattice> : ILattice<Maybe<T>>
Expand Down
3 changes: 3 additions & 0 deletions src/ILLink.Shared/DataFlow/ValueSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public bool Equals (ValueSet<TValue> other)
}
}

public static bool operator ==(ValueSet<TValue> left, ValueSet<TValue> right) => left.Equals(right);
public static bool operator !=(ValueSet<TValue> left, ValueSet<TValue> right) => !(left == right);

public override int GetHashCode ()
{
if (_values == null)
Expand Down
1 change: 1 addition & 0 deletions src/ILLink.Shared/TypeSystemProxy/WellKnownType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static (string Namespace, string Name) GetNamespaceAndName (this WellKnow
WellKnownType.System_NotSupportedException => ("System", "NotSupportedException"),
WellKnownType.System_Runtime_CompilerServices_DisablePrivateReflectionAttribute => ("System.Runtime.CompilerServices", "DisablePrivateReflectionAttribute"),
WellKnownType.System_Void => ("System", "Void"),
_ => throw new System.ArgumentException (type.ToString ())
};
}
public static string GetNamespace (this WellKnownType type) => GetNamespaceAndName (type).Namespace;
Expand Down
3 changes: 3 additions & 0 deletions src/linker/Linker.Dataflow/HoistedLocalKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ public HoistedLocalKey (FieldDefinition field)
public override bool Equals (object? obj) => obj is HoistedLocalKey other && Equals (other);

public override int GetHashCode () => Field.GetHashCode ();

public static bool operator ==(HoistedLocalKey left, HoistedLocalKey right) => left.Equals(right);
public static bool operator !=(HoistedLocalKey left, HoistedLocalKey right) => !(left == right);
}
}
3 changes: 3 additions & 0 deletions src/linker/Linker.Dataflow/ValueNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,8 @@ public ValueBasicBlockPair (MultiValue value, int basicBlockIndex)
public override bool Equals (object? obj) => obj is ValueBasicBlockPair other && Equals (other);

public override int GetHashCode () => HashUtils.Combine (Value.GetHashCode (), BasicBlockIndex);

public static bool operator ==(ValueBasicBlockPair left, ValueBasicBlockPair right) => left.Equals(right);
public static bool operator !=(ValueBasicBlockPair left, ValueBasicBlockPair right) => !(left == right);
}
}

0 comments on commit 317c4a1

Please sign in to comment.