From 6519aa955dd765072ac25881b127796d43de2b9a Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 4 Sep 2024 12:30:47 -0400 Subject: [PATCH] vet: add regression test for printf checker regression Updates golang/go#68796 Change-Id: I5bfa80216deff76fd9aabe9882f93fbfaebef957 Reviewed-on: https://go-review.googlesource.com/c/go/+/610737 Auto-Submit: Alan Donovan LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob --- src/cmd/vet/testdata/print/print.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cmd/vet/testdata/print/print.go b/src/cmd/vet/testdata/print/print.go index fffe571163..e00222c42b 100644 --- a/src/cmd/vet/testdata/print/print.go +++ b/src/cmd/vet/testdata/print/print.go @@ -678,3 +678,12 @@ func PointersToCompoundTypes() { } fmt.Printf("%s\n", T1{&T2{"x"}}) // ERROR "Printf format %s has arg T1{&T2{.x.}} of wrong type .*print\.T1" } + +// Regression test for #68796: materialized aliases cause printf +// checker not to recognize "any" as identical to "interface{}". +func printfUsingAnyNotEmptyInterface(format string, args ...any) { + _ = fmt.Sprintf(format, args...) +} +func _() { + printfUsingAnyNotEmptyInterface("%s", 123) // ERROR "wrong type" +} -- 2.51.0