Debian Codegraph @

simple/s1002/testdata/go1.18/CheckIfBoolCmp/bool-cmp_generics.go.golden

raw
1 package pkg
2
3 func tpfn1[T any]() T { var zero T; return zero }
4
5 func tpfn() {
6 if tpfn1[bool]() { //@ diag(`simplified to tpfn1[bool]()`)
7 }
8 if tpfn1[any]() == true {
9 }
10 }
11
12 func tpfn2[T bool](x T) {
13 if x { //@ diag(`omit comparison to bool constant`)
14 }
15 }
16
17 func tpfn3[T ~bool](x T) {
18 if x { //@ diag(`omit comparison to bool constant`)
19 }
20 }
21
22 type MyBool bool
23
24 func tpfn4[T bool | MyBool](x T) {
25 if x { //@ diag(`omit comparison to bool constant`)
26 }
27 }