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

Update PropertyTabAttribute.Equals() nullability #85896

Merged
merged 1 commit into from
May 9, 2023
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 @@ -1164,7 +1164,7 @@ public PropertyTabAttribute(System.Type tabClass, System.ComponentModel.Property
public System.Type[] TabClasses { get { throw null; } }
protected string[]? TabClassNames { get { throw null; } }
public System.ComponentModel.PropertyTabScope[] TabScopes { get { throw null; } }
public bool Equals(System.ComponentModel.PropertyTabAttribute other) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.ComponentModel.PropertyTabAttribute? other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other) { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Types referenced by tabClassNames may be trimmed.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,34 +145,25 @@ private void InitializeTabClasses()
public PropertyTabScope[] TabScopes { get; private set; }

public override bool Equals([NotNullWhen(true)] object? other)
{
if (other is PropertyTabAttribute propertyTabAttribute)
{
return Equals(propertyTabAttribute);
}
return false;
}
=> Equals(other as PropertyTabAttribute);

public bool Equals(PropertyTabAttribute other)
public bool Equals([NotNullWhen(true)] PropertyTabAttribute? other)
{
if (other == (object)this)
{
if (other is null)
return false;

buyaa-n marked this conversation as resolved.
Show resolved Hide resolved
if (ReferenceEquals(this, other))
return true;
}
if (other.TabClasses.Length != TabClasses.Length ||
other.TabScopes.Length != TabScopes.Length)
{

if (other.TabClasses.Length != TabClasses.Length || other.TabScopes.Length != TabScopes.Length)
return false;
}

for (int i = 0; i < TabClasses.Length; i++)
{
if (TabClasses[i] != other.TabClasses[i] ||
TabScopes[i] != other.TabScopes[i])
{
if (TabClasses[i] != other.TabClasses[i] || TabScopes[i] != other.TabScopes[i])
return false;
}
}

return true;
}

Expand Down