1
2
3
4
5
6
7
8
9
10
11 package main
12
13
14 func F(e interface{}) (int, int) {
15 return 3, 7
16 }
17
18
19 func G() (int, int) {
20 return 3, 7
21 }
22
23 func bogus1(d interface{}) (int, int) {
24 switch {
25 default:
26 return F(d)
27 }
28 return 0, 0
29 }
30
31 func bogus2() (int, int) {
32 switch {
33 default:
34 return F(3)
35 }
36 return 0, 0
37 }
38
39 func bogus3(d interface{}) (int, int) {
40 switch {
41 default:
42 return G()
43 }
44 return 0, 0
45 }
46
47 func bogus4() (int, int) {
48 switch {
49 default:
50 return G()
51 }
52 return 0, 0
53 }
54
55 func check(a, b int) {
56 if a != 3 || b != 7 {
57 println(a, b)
58 panic("a != 3 || b != 7")
59 }
60 }
61
62 func main() {
63 check(bogus1(42))
64 check(bogus2())
65 }
66
View as plain text