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

gnolang/pkg/gnovm: obscure runtime panic #3731

Open
odeke-em opened this issue Feb 11, 2025 · 0 comments · May be fixed by #3752
Open

gnolang/pkg/gnovm: obscure runtime panic #3731

odeke-em opened this issue Feb 11, 2025 · 0 comments · May be fixed by #3752
Labels
🐞 bug Something isn't working

Comments

@odeke-em
Copy link
Contributor

If we run this code https://play.gno.land/p/4gMJ8TWBba5 we get back this obscure error

/src/package.gno:0: unknown Go type *ast.IndexListExpr: (*ast.IndexListExpr)(0x2c1c9c0)({
 X: (*ast.SelectorExpr)(0x2c1a468)({
  X: (*ast.Ident)(0x2c17a80)(n),
  Sel: (*ast.Ident)(0x2c17aa0)(children)
 }),
 Lbrack: (token.Pos) 16786,
 Indices: ([]ast.Expr) (len=2 cap=2) {
  (*ast.Ident)(0x2c17ac0)(targ),
  (*ast.Ident)(0x2c17ae0)(wndex)
 },
 Rbrack: (token.Pos) 16798
})

 (code=2).

but when ran in Go per https://go.dev/play/p/E0q3dB93ISs produces

./prog.go:491:7: undefined: recordFDDDDDDDDound
./prog.go:502:20: undefined: targ
./prog.go:502:26: invalid operation: more than one index
./prog.go:607:23: invalid operation: cannot take address of !n.records[i].Less(start) (value of type bool)
@odeke-em odeke-em added the 🐞 bug Something isn't working label Feb 11, 2025
odeke-em added a commit to odeke-em/gno that referenced this issue Feb 14, 2025
…nrecognized for Gno

The *ast.IndexListExpr is used for generics but in assignment operations
it is illegal to use. This change returns a proper error and matches
Go's output.
Also *ast.GoStmt is for spawning Go routines but those are forbidden
in Gno, hence reject them prescriptively instead of just spewing
out the raw ast type.

Fixes gnolang#3731
Updates gnolang#3751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
Status: Triage
1 participant