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

cmd/gc: Improve error message when no types in function signature #10762

Closed
btracey opened this issue May 8, 2015 · 3 comments
Closed

cmd/gc: Improve error message when no types in function signature #10762

btracey opened this issue May 8, 2015 · 3 comments

Comments

@btracey
Copy link
Contributor

btracey commented May 8, 2015

If one leaves out the types in a function signature (as in http://play.golang.org/p/dxiOWN_NS4)

func Foo(x, y, z) {}

The error is

/tmp/sandbox961476762/main.go:5: undefined: x
/tmp/sandbox961476762/main.go:5: undefined: y
/tmp/sandbox961476762/main.go:5: undefined: z

It would be nice if these said something along the lines of "no type provided in function signature" rather than undefined. This would be closer to the case where the final type is omitted (http://play.golang.org/p/TvhumXNd3Z)

/tmp/sandbox992442913/main.go:5: final function parameter must have type
@minux
Copy link
Member

minux commented May 9, 2015 via email

@ianlancetaylor
Copy link
Contributor

Closing this. Feel free to reopen if you have a suggestion for what the compiler can reasonably do. Note that this is not a syntax error, and that the compiler can't know that the names are undefined until parsing is complete.

@btracey
Copy link
Contributor Author

btracey commented Jun 3, 2015

Minux's reply makes sense, and I agree with the closure.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants