Merge pull request #3023 from erik-krogh/RedundantUpdate

Approved by esbena
This commit is contained in:
semmle-qlci
2020-03-12 09:34:53 +00:00
committed by GitHub
3 changed files with 8 additions and 2 deletions

View File

@@ -64,7 +64,10 @@ class RedundantIdemnecantOperand extends RedundantOperand {
* arguments to integers. For example, `x&x` is a common idiom for converting `x` to an integer.
*/
class RedundantIdempotentOperand extends RedundantOperand {
RedundantIdempotentOperand() { getParent() instanceof LogicalBinaryExpr }
RedundantIdempotentOperand() {
getParent() instanceof LogicalBinaryExpr and
not exists(UpdateExpr e | e.getParentExpr+() = this)
}
}
/**

View File

@@ -6,4 +6,6 @@ x == 23 || x == 23;
x & x;
// this may actually be OK, but it's not good style
pop() && pop();
pop() && pop();
foo[bar++] && foo[bar++] // OK