Debian Codegraph @

test/fixedbugs/issue5793.go

raw
1 // run
2
3 // Copyright 2013 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Issue 5793: calling 2-arg builtin with multiple-result f() call expression gives
8 // spurious error.
9
10 package main
11
12 func complexArgs() (float64, float64) {
13 return 5, 7
14 }
15
16 func appendArgs() ([]string, string) {
17 return []string{"foo"}, "bar"
18 }
19
20 func appendMultiArgs() ([]byte, byte, byte) {
21 return []byte{'a', 'b'}, '1', '2'
22 }
23
24 func main() {
25 if c := complex(complexArgs()); c != 5+7i {
26 panic(c)
27 }
28
29 if s := append(appendArgs()); len(s) != 2 || s[0] != "foo" || s[1] != "bar" {
30 panic(s)
31 }
32
33 if b := append(appendMultiArgs()); len(b) != 4 || b[0] != 'a' || b[1] != 'b' || b[2] != '1' || b[3] != '2' {
34 panic(b)
35 }
36 }