compiler: allow to use copy() return value

This commit is contained in:
Evgenii Stratonikov 2020-09-02 15:29:59 +03:00
parent 3d8c7af66c
commit 3af7ce8c6b
2 changed files with 18 additions and 0 deletions

View file

@ -427,4 +427,14 @@ func TestCopy(t *testing.T) {
}`
eval(t, src, []byte{0, 3})
})
t.Run("AssignToVariable", func(t *testing.T) {
src := `package foo
func Main() int {
src := []byte{3, 2, 1}
dst := make([]byte, 2)
n := copy(dst, src)
return n
}`
eval(t, src, big.NewInt(2))
})
}