| 1 | package issue70572 |
| 2 | |
| 3 | // Regression test for failure to detect that a call to B[bool].Printf |
| 4 | // was printf-like, because of a missing call to types.Func.Origin. |
| 5 | |
| 6 | import "fmt" |
| 7 | |
| 8 | type A struct{} |
| 9 | |
| 10 | func (v A) Printf(format string, values ...any) { // want Printf:"printfWrapper" |
| 11 | fmt.Printf(format, values...) |
| 12 | } |
| 13 | |
| 14 | type B[T any] struct{} |
| 15 | |
| 16 | func (v B[T]) Printf(format string, values ...any) { // want Printf:"printfWrapper" |
| 17 | fmt.Printf(format, values...) |
| 18 | } |
| 19 | |
| 20 | func main() { |
| 21 | var a A |
| 22 | var b B[bool] |
| 23 | a.Printf("x", 1) // want "arguments but no formatting directives" |
| 24 | b.Printf("x", 1) // want "arguments but no formatting directives" |
| 25 | } |