compiler: allow to use _ in constants

When `_` is unused it can be omitted from constant values mapping.
Catched when compiling `netmap` contract from nspcc-dev/neofs-contract.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2022-01-18 11:46:48 +03:00
parent 945b56e350
commit 970769e5b2
2 changed files with 17 additions and 3 deletions

View file

@ -12,6 +12,18 @@ import (
"github.com/stretchr/testify/require"
)
func TestUnusedGlobal(t *testing.T) {
src := `package foo
const (
_ int = iota
a
)
func Main() int {
return 1
}`
eval(t, src, big.NewInt(1))
}
func TestChangeGlobal(t *testing.T) {
src := `package foo
var a int