5 func incr(x int) int { return x + 1 }
7 func decr(x int) int { return x - 1 }
9 var unknown bool // defeat dead-code elimination
12 chA := make(chan func(int) int, 0) // @line c1makeA
13 chB := make(chan func(int) int, 0) // @line c1makeB
16 chB <- func(int) int { return 1 }
18 print(chA) // @pointsto makechan@c1makeA:13
19 print(<-chA) // @pointsto main.incr
21 print(chB) // @pointsto makechan@c1makeB:13
22 print(<-chB) // @pointsto main.decr | main.chan1$1
26 chA := make(chan func(int) int, 0) // @line c2makeA
27 chB := make(chan func(int) int, 0) // @line c2makeB
30 chB <- func(int) int { return 1 }
32 // Channels flow together.
33 // Labelsets remain distinct but elements are merged.
39 print(chA) // @pointsto makechan@c2makeA:13
40 print(<-chA) // @pointsto main.incr
42 print(chB) // @pointsto makechan@c2makeB:13
43 print(<-chB) // @pointsto main.decr | main.chan2$1
45 print(chAB) // @pointsto makechan@c2makeA:13 | makechan@c2makeB:13
46 print(<-chAB) // @pointsto main.incr | main.decr | main.chan2$1
51 // @calls main.chan2 -> main.incr
54 chA := make(chan func(int) int, 0) // @line c3makeA
55 chB := make(chan func(int) int, 0) // @line c3makeB
58 chB <- func(int) int { return 1 }
59 print(chA) // @pointsto makechan@c3makeA:13
60 print(<-chA) // @pointsto main.incr
61 print(chB) // @pointsto makechan@c3makeB:13
62 print(<-chB) // @pointsto main.decr | main.chan3$1
67 // @calls main.chan3 -> main.incr
70 chA := make(chan func(int) int, 0) // @line c4makeA
71 chB := make(chan func(int) int, 0) // @line c4makeB
77 print(a) // @pointsto main.incr
79 print(b) // @pointsto main.decr
81 print(chA) // @pointsto makechan@c4makeA:13
82 print(chB) // @pointsto makechan@c4makeB:13
86 print(k) // @pointsto main.incr
88 // Exercise constraint generation (regtest for a crash).
93 // Multi-word channel value in select with multiple receive cases.
94 // (Regtest for a crash.)
101 ch <- T{new(int), incr} // @line ch5new
104 print(a.x) // @pointsto new@ch5new:13
105 print(a.y) // @types func(x int) int
107 print(b.x) // @pointsto new@ch5new:13
108 print(b.y) // @types func(x int) int