Skip to content

Commit 6519aa9

Browse files
adonovangopherbot
authored andcommitted
vet: add regression test for printf checker regression
Updates golang#68796 Change-Id: I5bfa80216deff76fd9aabe9882f93fbfaebef957 Reviewed-on: https://go-review.googlesource.com/c/go/+/610737 Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent 024c900 commit 6519aa9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/cmd/vet/testdata/print/print.go

+9
Original file line numberDiff line numberDiff line change
@@ -678,3 +678,12 @@ func PointersToCompoundTypes() {
678678
}
679679
fmt.Printf("%s\n", T1{&T2{"x"}}) // ERROR "Printf format %s has arg T1{&T2{.x.}} of wrong type .*print\.T1"
680680
}
681+
682+
// Regression test for #68796: materialized aliases cause printf
683+
// checker not to recognize "any" as identical to "interface{}".
684+
func printfUsingAnyNotEmptyInterface(format string, args ...any) {
685+
_ = fmt.Sprintf(format, args...)
686+
}
687+
func _() {
688+
printfUsingAnyNotEmptyInterface("%s", 123) // ERROR "wrong type"
689+
}

0 commit comments

Comments
 (0)