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

Doesn't check for return #107

Closed
jaekwon opened this issue Apr 1, 2022 · 3 comments · Fixed by #119
Closed

Doesn't check for return #107

jaekwon opened this issue Apr 1, 2022 · 3 comments · Fixed by #119

Comments

@jaekwon
Copy link
Contributor

jaekwon commented Apr 1, 2022

Preprocessor doesn't check whether all code branch paths return in functions that have a return value.
This causes unexpected behavior during runtime, in my case I got:
interface conversion: gno.Stmt is nil, not *gno.AssignStmt.

TODO: make preprocessor ensure all branch paths return when necessary.
Alternatively, use the go compiler for type-checking.

@moul
Copy link
Member

moul commented Apr 4, 2022

Alternatively, use the go compiler for type-checking

Sounds like a very smart quick-win to me

From a shell, I would not use go build but go fmt -e which will be a way faster and only focused on syntax checking

The source code is here: https://cs.opensource.google/go/go/+/refs/tags/go1.18:src/cmd/gofmt/gofmt.go;l=225

@jaekwon
Copy link
Contributor Author

jaekwon commented Apr 10, 2022

@moul moul mentioned this issue Apr 14, 2022
15 tasks
@moul
Copy link
Member

moul commented Apr 14, 2022

@jaekwon I plan to update #119 to automatically run unit tests against the official examples/gno.land/* gno files

If you have any pieces of code that you think relevant enough to be hardcoded in the gno2go unit tests because you worry they happen in production, feel free to update my PR or share here some code snippets, and I can handle the rest

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

Successfully merging a pull request may close this issue.

2 participants