Skip to content

Commit fe566f0

Browse files
committed
Fix test - ignore parenthesized operands
1 parent 426bbfa commit fe566f0

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎go/ql/src/InconsistentCode/WhitespaceContradictsPrecedence.ql‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class HarmlessNestedExpr extends BinaryExpr {
6767
*/
6868
predicate interestingNesting(BinaryExpr inner, BinaryExpr outer) {
6969
inner = outer.getAChildExpr() and
70+
not isParenthesized(inner, _) and
7071
not inner instanceof AssocNestedExpr and
7172
not inner instanceof HarmlessNestedExpr
7273
}

‎go/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/ParenthesizedOperands.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ func weightedMeanGood(a, b float64, countA, countB, total int) float64 {
77
}
88

99
func parenthesizedGood(a, b, c int) int {
10-
return (a ^ b)&c // $ SPURIOUS: Alert
10+
return (a ^ b)&c
1111
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
| ParenthesizedOperands.go:10:9:10:17 | ...&... | ^ is evaluated before &, but whitespace suggests the opposite. |
21
| WhitespaceContradictsPrecedence.go:6:9:6:18 | ...<<... | & is evaluated before <<, but whitespace suggests the opposite. |
32
| main.go:14:9:14:16 | ...+... | >> is evaluated before +, but whitespace suggests the opposite. |

0 commit comments

Comments
 (0)