File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
src/Violations of Best Practice/Boolean Logic
test/kotlin/query-tests/SimplifyBoolExpr Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -92,13 +92,16 @@ class ComparisonOrEquality extends BinaryExpr {
92
92
93
93
from Expr e , string pattern , string rewrite
94
94
where
95
- e .( BoolCompare ) .simplify ( pattern , rewrite )
96
- or
97
- conditionalWithBool ( e , pattern , rewrite )
98
- or
99
- e .( LogNotExpr ) .getExpr ( ) .( ComparisonOrEquality ) .negate ( pattern , rewrite )
100
- or
101
- e .( LogNotExpr ) .getExpr ( ) instanceof LogNotExpr and
102
- pattern = "!!A" and
103
- rewrite = "A"
95
+ e .getFile ( ) .isJavaSourceFile ( ) and
96
+ (
97
+ e .( BoolCompare ) .simplify ( pattern , rewrite )
98
+ or
99
+ conditionalWithBool ( e , pattern , rewrite )
100
+ or
101
+ e .( LogNotExpr ) .getExpr ( ) .( ComparisonOrEquality ) .negate ( pattern , rewrite )
102
+ or
103
+ e .( LogNotExpr ) .getExpr ( ) instanceof LogNotExpr and
104
+ pattern = "!!A" and
105
+ rewrite = "A"
106
+ )
104
107
select e , "Expressions of the form \"" + pattern + "\" can be simplified to \"" + rewrite + "\"."
Original file line number Diff line number Diff line change 1
- | SimplifyBoolExpr.kt:8:8:8:16 | ... (value equals) ... | Expressions of the form "A == true" can be simplified to "A". |
You can’t perform that action at this time.
0 commit comments