Source file
test/phiopt.go
1
2
3
4
5
6
7
8
9 package main
10
11
12 func f0(a bool) bool {
13 x := false
14 if a {
15 x = true
16 } else {
17 x = false
18 }
19 return x
20 }
21
22
23 func f1(a bool) bool {
24 x := false
25 if a {
26 x = false
27 } else {
28 x = true
29 }
30 return x
31 }
32
33
34 func f2(a, b int) bool {
35 x := true
36 if a == b {
37 x = false
38 }
39 return x
40 }
41
42
43 func f3(a, b int) bool {
44 x := false
45 if a == b {
46 x = true
47 }
48 return x
49 }
50
51
52 func f4(a, b bool) bool {
53 return a || b
54 }
55
56
57 func f5or(a int, b bool) bool {
58 var x bool
59 if a == 0 {
60 x = true
61 } else {
62 x = b
63 }
64 return x
65 }
66
67
68 func f5and(a int, b bool) bool {
69 var x bool
70 if a == 0 {
71 x = b
72 } else {
73 x = false
74 }
75 return x
76 }
77
78
79 func f6or(a int, b bool) bool {
80 x := b
81 if a == 0 {
82
83 x = f6or(a, b)
84 }
85 return x
86 }
87
88
89 func f6and(a int, b bool) bool {
90 x := b
91 if a == 0 {
92
93 x = f6and(a, b)
94 }
95 return x
96 }
97
98
99 func f7or(a bool, b bool) bool {
100 return a || b
101 }
102
103
104 func f7and(a bool, b bool) bool {
105 return a && b
106 }
107
108
109 func f8(s string) (string, bool) {
110 neg := false
111 if s[0] == '-' {
112 neg = true
113 s = s[1:]
114 }
115 return s, neg
116 }
117
118 var d int
119
120
121 func f9(a, b int) bool {
122 c := false
123 if a < 0 {
124 if b < 0 {
125 d = d + 1
126 }
127 c = true
128 }
129 return c
130 }
131
132 func main() {
133 }
134
View as plain text