Skip to content

Commit 209771a

Browse files
committed
C#: Fix bad join in cs/coalesce-of-identical-expressions.
1 parent 147ac37 commit 209771a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

csharp/ql/src/Language Abuse/UselessNullCoalescingExpression.ql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515
import csharp
1616
import semmle.code.csharp.commons.StructuralComparison
1717

18+
pragma[nomagic]
19+
private Expr getARightChildExpr(NullCoalescingOperation nce) {
20+
result = nce.getRightOperand().getAChildExpr*()
21+
}
22+
1823
pragma[noinline]
1924
private predicate same(AssignableAccess x, AssignableAccess y) {
2025
exists(NullCoalescingOperation nc |
2126
x = nc.getLeftOperand() and
22-
y = nc.getRightOperand().getAChildExpr*()
27+
y = getARightChildExpr(nc)
2328
) and
2429
sameGvn(x, y)
2530
}

0 commit comments

Comments
 (0)