honnef.co/go/tools@v0.4.7/staticcheck/testdata/src/example.com/CheckRangeStringRunes/generics.go (about)

     1  //go:build go1.18
     2  
     3  package pkg
     4  
     5  func tpfn1[T string](x T) {
     6  	for _, c := range []rune(x) { //@ diag(`should range over string`)
     7  		println(c)
     8  	}
     9  }
    10  
    11  func tpfn2[T1 string, T2 []rune](x T1) {
    12  	for _, c := range T2(x) { //@ diag(`should range over string`)
    13  		println(c)
    14  	}
    15  }