compiler: support implicit type in function arguments

Go supports declaring multiple arguments of the same type without
duplicating type name. Now we support this too.
This commit is contained in:
Evgenii Stratonikov 2020-05-06 18:20:12 +03:00
parent d3f1ccd518
commit 7ac15a7557
2 changed files with 15 additions and 3 deletions

View file

@ -158,3 +158,14 @@ func TestFunctionWithVoidReturnBranch(t *testing.T) {
eval(t, src, big.NewInt(2))
})
}
func TestFunctionWithMultipleArgumentNames(t *testing.T) {
src := `package foo
func Main() int {
return add(1, 2)
}
func add(a, b int) int {
return a + b
}`
eval(t, src, big.NewInt(3))
}