x/tools/go/analysis/passes/printf: missing recursive call issue for type paramaterized String #55928
Labels
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go test
What did you expect to see?
main.go:10:2: fmt.Println arg a causes recursive call to (A[T]).String method
What did you see instead?
Everything ok.
I believe the issue is that the type of
String
method here isfunc() T
and the analyzer expectsfunc() string
. We could flag the program ifstring
satisfies the constraints ofT
. This could lead to false positives ifA[T]
is never instantiated withstring
, but that might happen very rarely.Note that the analyzer currently correctly reports the issue when the return type is
string
.@timothy-king @findleyr
The text was updated successfully, but these errors were encountered: