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

AST Output When Using Unsupported Keyworkds #3751

Open
notJoon opened this issue Feb 14, 2025 · 2 comments
Open

AST Output When Using Unsupported Keyworkds #3751

notJoon opened this issue Feb 14, 2025 · 2 comments

Comments

@notJoon
Copy link
Member

notJoon commented Feb 14, 2025

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.

@odeke-em
Copy link
Contributor

I've got this! I have started sending PRs fixing these and making the output more prespective. Please feel free to assign this to me.

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
@odeke-em
Copy link
Contributor

I've mailed out to begin with #3752

odeke-em added a commit to odeke-em/gno that referenced this issue Feb 18, 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
odeke-em added a commit to odeke-em/gno that referenced this issue Feb 18, 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
odeke-em added a commit to odeke-em/gno that referenced this issue Feb 22, 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
odeke-em added a commit to odeke-em/gno that referenced this issue Feb 22, 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
odeke-em added a commit to odeke-em/gno that referenced this issue Feb 22, 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
odeke-em added a commit to odeke-em/gno that referenced this issue Feb 22, 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
odeke-em added a commit to odeke-em/gno that referenced this issue Feb 22, 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
None yet
Projects
Status: Triage
Development

No branches or pull requests

2 participants