x/tools/go/callgraph/cha: spurious callgraph edges to unexported functions #66689
Labels
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
When the
cha
library processes a method call on an interface value, it must calculate the concrete methods that it may call at runtime. It does this by finding all methods whose name matches the selector, and whose type satisfies the interface. The name matching is done using plain string equality, but this is not quite right, because unexported identifiers in different packages are always considered different, even if they are spelled the same.Performing the string matching on the output of
go/types.Id
for the selector and method names would fix this.See the test program in https://go.dev/cl/574955 for an example. There, a type
S1
which embeds atypes.Object
, and a methodorder
are defined:S1
satisfies thego/types.Object
interface, but code ingo/types
that callsorder
on atypes.Object
value cannot call theorder
method ofS1
defined here, it can only call anorder
method of the embeddedtypes.Object
which was defined ingo/types
.The text was updated successfully, but these errors were encountered: