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

missing length check in value declaration #2137

Closed
ltzmaxwell opened this issue May 17, 2024 · 0 comments · Fixed by #2206
Closed

missing length check in value declaration #2137

ltzmaxwell opened this issue May 17, 2024 · 0 comments · Fixed by #2206
Assignees
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@ltzmaxwell
Copy link
Contributor

ltzmaxwell commented May 17, 2024

This does not compile as expected, aside from the error message, which suggests that a sanity check should be performed instead of a simple type assertion.

package main

func main() {
	var a, b = 1
}

// Error:
// interface conversion: gnolang.Expr is *gnolang.ConstExpr, not *gnolang.CallExpr

This situation is similar in that it doesn't compile as expected, but the error message indicates that it should be checked beforehand, possibly within predefineFileSet, and then halted.

package main

func main() {
	var a, b, c = 1, a + 1
	println(a)
	println(b)
	println(c)
}

// Error:
// main/files/value_decl1.gno:3: constant definition loop with a:
@ltzmaxwell ltzmaxwell mentioned this issue May 17, 2024
5 tasks
@zivkovicmilos zivkovicmilos added 📦 🤖 gnovm Issues or PRs gnovm related help wanted labels May 20, 2024
@Kouteki Kouteki added the 🐞 bug Something isn't working label May 31, 2024
thehowl pushed a commit that referenced this issue Jul 30, 2024
Closes #2137 
<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Co-authored-by: Miloš Živković <milos@zmilos.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Development

Successfully merging a pull request may close this issue.

4 participants