diff --git a/gnovm/pkg/gnolang/go2gno.go b/gnovm/pkg/gnolang/go2gno.go index 7d0ccf13bf6..7d13ce66308 100644 --- a/gnovm/pkg/gnolang/go2gno.go +++ b/gnovm/pkg/gnolang/go2gno.go @@ -496,6 +496,13 @@ func Go2Gno(fs *token.FileSet, gon ast.Node) (n Node) { } case *ast.EmptyStmt: return &EmptyStmt{} + case *ast.IndexListExpr: + if len(gon.Indices) > 1 { + panic(&LocationPlusError{posn(), "invalid operation: more than one index"}) + } + panic(&LocationPlusError{posn(), "invalid operation: indexList is not permitted in Gno"}) + case *ast.GoStmt: + panic(&LocationPlusError{posn(), "goroutines are not permitted"}) default: panic(&LocationPlusError{posn(), fmt.Sprintf("unknown Go type %v: %s\n", reflect.TypeOf(gon), diff --git a/gnovm/tests/files/goroutine_not_supported.gno b/gnovm/tests/files/goroutine_not_supported.gno new file mode 100644 index 00000000000..6c3b2072e2a --- /dev/null +++ b/gnovm/tests/files/goroutine_not_supported.gno @@ -0,0 +1,16 @@ +// https://github.com/gnolang/gno/issues/3751 + +package math + +import "testing" + +func Add(a, b int) int { + return a + b +} + +func TestAdd(t *testing.T) { + go Add(1, 1) +} + +// Error: +// goroutine_not_supported.gno:12:5: goroutines are not permitted diff --git a/gnovm/tests/files/parse_indexListExpr.gno b/gnovm/tests/files/parse_indexListExpr.gno new file mode 100644 index 00000000000..7caf2406f6e --- /dev/null +++ b/gnovm/tests/files/parse_indexListExpr.gno @@ -0,0 +1,16 @@ +// https://github.com/gnolang/gno/issues/3731 + +package main + +type node struct { + r []int +} + +func (n *node) foo(targ, wndex int) { + _ = n.r[targ, wndex] +} + +func main() {} + +// ERROR: +// parse_indexListExpr.gno:10:6: invalid operation: more than one index