The documentation for types.Info.Instances states the following invariant:
// Invariant: Instantiating Uses[id].Type() with Instances[id].TypeArgs
// results in an equivalent of Instances[id].Type.
Depending on how we interpret "equivalent", this might not be true for calls of generic methods. Entries in Instances will have signatures without receivers, while using types.Instantiate maintains receivers: https://go.dev/play/p/ffy1wUtHGX1?v=gotip
Now, the documentation of types.Signature states that "[t]he receiver is ignored when comparing signatures for identity", but it is not clear whether "equivalent" refers to type identity. I find the loss of the receiver inconvenient either way.
@griesemer
The documentation for
types.Info.Instancesstates the following invariant:Depending on how we interpret "equivalent", this might not be true for calls of generic methods. Entries in
Instanceswill have signatures without receivers, while usingtypes.Instantiatemaintains receivers: https://go.dev/play/p/ffy1wUtHGX1?v=gotipNow, the documentation of
types.Signaturestates that "[t]he receiver is ignored when comparing signatures for identity", but it is not clear whether "equivalent" refers to type identity. I find the loss of the receiver inconvenient either way.@griesemer