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

cryptic error: v := f(), when f returns no values, panics with evalStaticTypeOf() only supports *CallExpr with 1 result #1082

Closed
thehowl opened this issue Aug 30, 2023 · 1 comment
Assignees
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related 🌟 improvement performance improvements, refactors ...

Comments

@thehowl
Copy link
Member

thehowl commented Aug 30, 2023

Minimal example to reproduce:

package main

func main() {
        n := f()
}

func f() {
        println("hello!")
}

The resulting panic is the following:

panic: evalStaticTypeOf() only supports *CallExpr with 1 result, got () [recovered]
        panic: main/a.gno:4: evalStaticTypeOf() only supports *CallExpr with 1 result, got ()

goroutine 1 [running]:
github.com/gnolang/gno/gnovm/pkg/gnolang.Preprocess.func2.1()
        /home/howl/oc/gno/gnovm/pkg/gnolang/preprocess.go:173 +0x46d
panic({0xbf0b00, 0xc00007d450})
        /usr/lib/go/src/runtime/panic.go:890 +0x263
github.com/gnolang/gno/gnovm/pkg/gnolang.evalStaticTypeOf({0xf651b0?, 0xc000188240?}, {0xf62ed8?, 0xc000501800?}, {0xf5c408?, 0xc000128a20?})
        /home/howl/oc/gno/gnovm/pkg/gnolang/preprocess.go:2020 +0xc5
github.com/gnolang/gno/gnovm/pkg/gnolang.Preprocess.func2({0xc00025ae00?, 0x2, 0x20}, 0x46, 0xc000254524?, {0xf5aaf0, 0xc000128a80?}, 0x3)
        /home/howl/oc/gno/gnovm/pkg/gnolang/preprocess.go:1554 +0x8688
github.com/gnolang/gno/gnovm/pkg/gnolang.transcribe(0xc000131970, {0xc00025ae00?, 0x2, 0x20}, 0x46, 0xf5b170?, {0xf5aaf0?, 0xc000128a80}, 0xc000131447)
        /home/howl/oc/gno/gnovm/pkg/gnolang/transcribe.go:728 +0x4b63
github.com/gnolang/gno/gnovm/pkg/gnolang.transcribe(0xc000131970, {0xc00025ae00?, 0x1, 0x20}, 0x4d, 0xf5b0a0?, {0xf5b170?, 0xc000501800}, 0xc000131677)
        /home/howl/oc/gno/gnovm/pkg/gnolang/transcribe.go:670 +0x5125
github.com/gnolang/gno/gnovm/pkg/gnolang.transcribe(0xc000131970, {0xc00025ae00?, 0x0, 0x20}, 0x0, 0x200?, {0xf5b0a0?, 0xc0002b3b80}, 0xc0001318a7)
        /home/howl/oc/gno/gnovm/pkg/gnolang/transcribe.go:708 +0x4cf3
github.com/gnolang/gno/gnovm/pkg/gnolang.Transcribe({0xf5b0a0?, 0xc0002b3b80}, 0x7ffe8a9f6e65?)
        /home/howl/oc/gno/gnovm/pkg/gnolang/transcribe.go:133 +0xbe
github.com/gnolang/gno/gnovm/pkg/gnolang.Preprocess({0xf651b0, 0xc000188240}, {0xf632d8, 0xc0000ca580}, {0xf5b0a0?, 0xc0002b3b80?})
        /home/howl/oc/gno/gnovm/pkg/gnolang/preprocess.go:149 +0x277
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runFiles(0xc0000c4fc0, {0xc0000123e8, 0x1, 0x1})
        /home/howl/oc/gno/gnovm/pkg/gnolang/machine.go:520 +0x34e
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunFiles(...)

This is not such a weird mistake to do when programming in Go/Gno, so a panic like this with no reference to the incriminated code is hardly helpful to the developer.

(Part of a series of issues encountered while developing gnochess)

@thehowl thehowl added 📦 🤖 gnovm Issues or PRs gnovm related 🌟 improvement performance improvements, refactors ... labels Aug 30, 2023
@moul moul moved this to 🚀 Needed for Launch in 🚀 The Launch [DEPRECATED] Sep 5, 2023
@moul moul added this to the 🚀 main.gno.land milestone Sep 6, 2023
@moul moul added the 🐞 bug Something isn't working label Oct 27, 2023
@hthieu1110 hthieu1110 self-assigned this Oct 30, 2024
ltzmaxwell pushed a commit that referenced this issue Nov 25, 2024
…tion which does not return any value (#3049)

This PR aims at resolving this issue:
#1082

This depends on #3017 because it
refactored the code to sync the logic/code between AssignStmt vs
ValueDecl.

Related #2695

<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
</details>

---------

Co-authored-by: hieu.ha <[email protected]>
Co-authored-by: Mikael VALLENET <[email protected]>
n0izn0iz pushed a commit to n0izn0iz/gno that referenced this issue Nov 26, 2024
…tion which does not return any value (gnolang#3049)

This PR aims at resolving this issue:
gnolang#1082

This depends on gnolang#3017 because it
refactored the code to sync the logic/code between AssignStmt vs
ValueDecl.

Related gnolang#2695

<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
</details>

---------

Co-authored-by: hieu.ha <[email protected]>
Co-authored-by: Mikael VALLENET <[email protected]>
@Kouteki
Copy link
Contributor

Kouteki commented Nov 26, 2024

Solved by #3049

@Kouteki Kouteki closed this as completed Nov 26, 2024
r3v4s pushed a commit to gnoswap-labs/gno that referenced this issue Dec 10, 2024
…tion which does not return any value (gnolang#3049)

This PR aims at resolving this issue:
gnolang#1082

This depends on gnolang#3017 because it
refactored the code to sync the logic/code between AssignStmt vs
ValueDecl.

Related gnolang#2695

<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
</details>

---------

Co-authored-by: hieu.ha <[email protected]>
Co-authored-by: Mikael VALLENET <[email protected]>
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 🌟 improvement performance improvements, refactors ...
Projects
Status: Teritori (confirmed)
Development

Successfully merging a pull request may close this issue.

5 participants