Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
go/types: request for NewSelection constructor #12881
Consider (*ssa.Program).MethodValue(sel *types.Selection) *ssa.Function. It requires a *types.Selection as its argument. If you have the receiver type T and the selector name (pkg, name), you can obtain a Selection by calling types.NewMethodSet(T).Lookup(pkg, name), but this is asymptotically more expensive than calling types.LookupFieldOrMethod(T, false, pkg, name).
Ideally the client would be able to call LookupFieldOrMethod and then construct a Selection (field or method) from the result, but there is no way for clients to construct a Selection.
Could we expose a NewSelection constructor?
(see #10091 for background)