github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/simple/s1002/testdata/src/example.com/CheckIfBoolCmp/bool-cmp.go.golden (about) 1 package pkg 2 3 func fn1() bool { return false } 4 func fn2() bool { return false } 5 6 func fn() { 7 type T bool 8 var x T 9 const t T = false 10 if x == t { 11 } 12 if fn1() { //@ diag(`simplified to fn1()`) 13 } 14 if !fn1() { //@ diag(`simplified to !fn1()`) 15 } 16 if !fn1() { //@ diag(`simplified to !fn1()`) 17 } 18 if fn1() { //@ diag(`simplified to fn1()`) 19 } 20 if fn1() && (fn1() || fn1()) || (fn1() && fn1()) { //@ diag(`simplified to (fn1() && fn1())`) 21 } 22 23 if !(fn1() && fn2()) { //@ diag(`simplified to !(fn1() && fn2())`) 24 } 25 26 var y bool 27 for !y { //@ diag(`simplified to !y`) 28 } 29 if !y { //@ diag(`simplified to !y`) 30 } 31 if y { //@ diag(`simplified to y`) 32 } 33 if y { //@ diag(`simplified to y`) 34 } 35 if !y { //@ diag(`simplified to !y`) 36 } 37 if !y { //@ diag(`simplified to !y`) 38 } 39 if y { //@ diag(`simplified to y`) 40 } 41 if y { //@ diag(`simplified to y`) 42 } 43 if !y { //@ diag(`simplified to !y`) 44 } 45 if !y { //@ diag(`simplified to !y`) 46 } 47 if y { //@ diag(`simplified to y`) 48 } 49 if !y == !false { // not matched because we expect true/false on one side, not !false 50 } 51 52 var z interface{} 53 if z == true { 54 } 55 }