Open
Description
Description
Currently gno does not support go
keyword. When this keyword is used in tests, it outputs the AST instead of an appropriate error message.
Reproduction
// add.go
package math
func Add(a, b int) int {
return a + b
}
// add_test.go
package math
import "testing"
func TestAdd(t *testing.T) {
go Add(1, 1) // <- This line triggers AST output
}
Current Output
gno.land/r/gnoswap/v1/a0:0: unknown Go type *ast.GoStmt: (*ast.GoStmt)(0x14003f27480)({
Go: (token.Pos) 268,
Call: (*ast.CallExpr)(0x14000967300)({
Fun: (*ast.Ident)(0x14007738f60)(Add),
Lparen: (token.Pos) 274,
Args: ([]ast.Expr) (len=2 cap=2) {
(*ast.BasicLit)(0x14007738fa0)({
ValuePos: (token.Pos) 275,
Kind: (token.Token) INT,
Value: (string) (len=1) "1"
}),
(*ast.BasicLit)(0x14007738fe0)({
ValuePos: (token.Pos) 278,
Kind: (token.Token) INT,
Value: (string) (len=1) "1"
})
},
Ellipsis: (token.Pos) 0,
Rparen: (token.Pos) 279
})
})
Expected Behaviour
When using the unsupported keyword, a clear error message such as "keyword is not supported" should be displayed instead of the AST output.
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Triage