Skip to content

Commit 74622cf

Browse files
committed
C#: Fix join-order following stats update
1 parent 12c2854 commit 74622cf

File tree

1 file changed

+7
-5
lines changed
  • csharp/ql/src/semmle/code/csharp/frameworks

1 file changed

+7
-5
lines changed

csharp/ql/src/semmle/code/csharp/frameworks/System.qll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,16 +588,19 @@ predicate implementsEquals(ValueOrRefType t) { getInvokedEqualsMethod(t).getDecl
588588
* from the `object.Equals(object)` method inherited by `t`.
589589
*/
590590
Method getInvokedEqualsMethod(ValueOrRefType t) {
591-
result = getInheritedEqualsMethod(t) and
591+
result = getInheritedEqualsMethod(t, _) and
592592
not exists(getInvokedIEquatableEqualsMethod(t, result))
593593
or
594594
exists(EqualsMethod eq |
595595
result = getInvokedIEquatableEqualsMethod(t, eq) and
596-
getInheritedEqualsMethod(t) = eq
596+
getInheritedEqualsMethod(t, _) = eq
597597
)
598598
}
599599

600-
private EqualsMethod getInheritedEqualsMethod(ValueOrRefType t) { t.hasMethod(result) }
600+
pragma[noinline]
601+
private EqualsMethod getInheritedEqualsMethod(ValueOrRefType t, ValueOrRefType decl) {
602+
t.hasMethod(result) and decl = result.getDeclaringType()
603+
}
601604

602605
/**
603606
* Equals method `eq` is inherited by `t`, `t` overrides `IEquatable<T>.Equals(T)`
@@ -621,10 +624,9 @@ private EqualsMethod getInheritedEqualsMethod(ValueOrRefType t) { t.hasMethod(re
621624
*/
622625
private IEquatableEqualsMethod getInvokedIEquatableEqualsMethod(ValueOrRefType t, EqualsMethod eq) {
623626
t.hasMethod(result) and
624-
eq = getInheritedEqualsMethod(t.getBaseClass()) and
625627
exists(IEquatableEqualsMethod ieem |
626628
result = ieem.getAnOverrider*() and
627-
eq.getDeclaringType() = ieem.getDeclaringType()
629+
eq = getInheritedEqualsMethod(t.getBaseClass(), ieem.getDeclaringType())
628630
|
629631
not ieem.fromSource()
630632
or

0 commit comments

Comments
 (0)