Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect parsing of parametric function Result #469

Closed
guns opened this issue Sep 3, 2017 · 1 comment
Closed

Incorrect parsing of parametric function Result #469

guns opened this issue Sep 3, 2017 · 1 comment

Comments

@guns
Copy link

guns commented Sep 3, 2017

According to https://golang.org/ref/spec#Function_types, a function can declare its return types as a list of parameters. The following function, therefore, is valid:

func f() (a, b io.Reader, c error) {
	return
}

Gocode, however, incorrectly determines that the second return type from f is error, not io.Reader, as demonstrated by the following:

package main

func f() (a, b io.Reader, c error) { return }

func main() {
	a, b, c := f()
	b.
}

With the above saved as issue.go:

$ gocode -in ./issue.go autocomplete 94
Found 1 candidates:
  func Error() string

Thank you for gocode!

@nsf nsf closed this as completed in c7fddb3 Sep 3, 2017
@nsf
Copy link
Owner

nsf commented Sep 3, 2017

Thanks for reporting it.

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

No branches or pull requests

2 participants