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:
parent
d3f1ccd518
commit
7ac15a7557
2 changed files with 15 additions and 3 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue