github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa4000/testdata/src/example.com/CheckLhsRhsIdentical/generics.go (about)

     1  //go:build go1.18
     2  
     3  package pkg
     4  
     5  func tpfn1[T comparable](x T) {
     6  	if x != x {
     7  	}
     8  }
     9  
    10  func tpfn2[T int | string](x T) {
    11  	if x != x { //@ diag(`identical expressions`)
    12  	}
    13  }
    14  
    15  func tpfn3[T int | float64](x T) {
    16  	if x != x {
    17  	}
    18  }
    19  
    20  func tpfn4[E int | int64, T [4]E](x T) {
    21  	if x != x { //@ diag(`identical expressions`)
    22  	}
    23  }
    24  
    25  func tpfn5[E int | float64, T [4]E](x T) {
    26  	if x != x {
    27  	}
    28  }