Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

suggest: include receiver parameter info in method hints #9

Closed
mdempsky opened this issue May 18, 2016 · 3 comments · Fixed by #100
Closed

suggest: include receiver parameter info in method hints #9

mdempsky opened this issue May 18, 2016 · 3 comments · Fixed by #100

Comments

@mdempsky
Copy link
Owner

It might be desirable to include receiver parameter information in hints for methods. At the very least, when hinting the type of a method expression, we should probably indicate that the method parameter has become a normal parameter.

For example, currently for bytes.Buffer.Write, we hint func Write(p []byte) (n int, err error), but the method expression's type is actually func (*bytes.Buffer, []byte) (int, error).

@segevfiner
Copy link

I don't think receivers are treated as the "first argument" by the go language... (Even if they are probably treated like that in the generated assembly).

Anyhow, knowing the functions receiver is needed in order to fix this issue in vscode-go: microsoft/vscode-go#2107.

@mdempsky
Copy link
Owner Author

I don't think receivers are treated as the "first argument" by the go language...

They are in the context of method expressions. For example, the type of (*bytes.Buffer).Write is func(*bytes.Buffer, []byte) (int, error). See: https://play.golang.org/p/HVzthYTo6bg

@ramya-rao-a
Copy link

cc @stamblerre

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants