1package main
2
3// Static tests of SSA builder (via the sanity checker).
4// Dynamic semantics are not exercised.
5
6func init() {
7	// Regression test for issue 6806.
8	ch := make(chan int)
9	select {
10	case n, _ := <-ch:
11		_ = n
12	default:
13		// The default case disables the simplification of
14		// select to a simple receive statement.
15	}
16
17	// value,ok-form receive where TypeOf(ok) is a named boolean.
18	type mybool bool
19	var x int
20	var y mybool
21	select {
22	case x, y = <-ch:
23	default:
24		// The default case disables the simplification of
25		// select to a simple receive statement.
26	}
27	_ = x
28	_ = y
29}
30
31var a int
32
33// Regression test for issue 7840 (covered by SSA sanity checker).
34func bug7840() bool {
35	// This creates a single-predecessor block with a φ-node.
36	return false && a == 0 && a == 0
37}
38
39// A blocking select (sans "default:") cannot fall through.
40// Regression test for issue 7022.
41func bug7022() int {
42	var c1, c2 chan int
43	select {
44	case <-c1:
45		return 123
46	case <-c2:
47		return 456
48	}
49}
50
51// Parens should not prevent intrinsic treatment of built-ins.
52// (Regression test for a crash.)
53func init() {
54	_ = (new)(int)
55	_ = (make)([]int, 0)
56}
57
58func main() {}
59