compiler: allow to use multiple underscores in func arguments
It should still be present in the argument array in VM so just don't save them in the map. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
fb31a81fd2
commit
8d562cef99
2 changed files with 18 additions and 0 deletions
|
@ -313,3 +313,14 @@ func TestJumpOptimize(t *testing.T) {
|
|||
require.Equal(t, b[mi.Range.End], byte(opcode.RET))
|
||||
}
|
||||
}
|
||||
|
||||
func TestFunctionUnusedParameters(t *testing.T) {
|
||||
src := `package foo
|
||||
func add13(a int, _ int, _1 int, _ int) int {
|
||||
return a + _1
|
||||
}
|
||||
func Main() int {
|
||||
return add13(1, 10, 100, 1000)
|
||||
}`
|
||||
eval(t, src, big.NewInt(101))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue