-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gnolang): prescriptively reject *ast.(IndexListExpr, GoStmt) as u…
…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 #3731 Updates #3751
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |