Skip to content

Commit 426bbfa

Browse files
committed
Add test with spurious result for go/whitespace-contradicts-precedence
1 parent 9269141 commit 426bbfa

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ package main
55
func weightedMeanGood(a, b float64, countA, countB, total int) float64 {
66
return ((a * float64(countA)) + (b * float64(countB))) / float64(total)
77
}
8+
9+
func parenthesizedGood(a, b, c int) int {
10+
return (a ^ b)&c // $ SPURIOUS: Alert
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
| ParenthesizedOperands.go:10:9:10:17 | ...&... | ^ is evaluated before &, but whitespace suggests the opposite. |
12
| WhitespaceContradictsPrecedence.go:6:9:6:18 | ...<<... | & is evaluated before <<, but whitespace suggests the opposite. |
23
| main.go:14:9:14:16 | ...+... | >> is evaluated before +, but whitespace suggests the opposite. |

0 commit comments

Comments
 (0)