github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/simple/testdata/src/bool-cmp/bool-cmp.go (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() == true { // MATCH "simplified to fn1()"
    13  	}
    14  	if fn1() != true { // MATCH "simplified to !fn1()"
    15  	}
    16  	if fn1() == false { // MATCH "simplified to !fn1()"
    17  	}
    18  	if fn1() != false { // MATCH "simplified to fn1()"
    19  	}
    20  	if fn1() && (fn1() || fn1()) || (fn1() && fn1()) == true { // MATCH "simplified to (fn1() && fn1())"
    21  	}
    22  
    23  	if (fn1() && fn2()) == false { // MATCH "simplified to !(fn1() && fn2())"
    24  	}
    25  
    26  	var y bool
    27  	for y != true { // MATCH /simplified to !y/
    28  	}
    29  	if !y == true { // MATCH /simplified to !y/
    30  	}
    31  	if !y == false { // MATCH /simplified to y/
    32  	}
    33  	if !y != true { // MATCH /simplified to y/
    34  	}
    35  	if !y != false { // MATCH /simplified to !y/
    36  	}
    37  	if !!y == false { // MATCH /simplified to !y/
    38  	}
    39  	if !!!y == false { // MATCH /simplified to y/
    40  	}
    41  	if !!y == true { // MATCH /simplified to y/
    42  	}
    43  	if !!!y == true { // MATCH /simplified to !y/
    44  	}
    45  	if !!y != true { // MATCH /simplified to !y/
    46  	}
    47  	if !!!y != true { // MATCH /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  }