...
1-- in.cue --
2x0: 5
3x1: b5 & 30
4
5b0: <x0 & >0
6b1: b0 & int
7b2: int & <5.5
8b3: <10 & <=5
9b4: >=20 & >20
10b5: >=21 & >20
11b6: int & >5 & <=6
12
13simplifyExpr: {
14 less1: <(<3)
15 less2: <(<=3)
16 less3: <=(<3)
17 less4: <=(<=3)
18 less5: <(!=3)
19 less6: <=(!=3)
20
21 gtr1: >(>3)
22 gtr2: >(>=3)
23 gtr3: >=(>3)
24 gtr4: >=(>=3)
25 gtr5: >(!=3)
26 gtr6: >=(!=3)
27
28 lg1: <(>3)
29 lg2: <(>=3)
30 lg3: <=(>3)
31 lg4: <=(>=3)
32
33 gl1: >(<3)
34 gl2: >(<=3)
35 gl3: >=(<3)
36 gl4: >=(<=3)
37
38 ne1: !=(!=3)
39 ne2: !=(<3)
40 ne3: !=(<=3)
41 ne4: !=(>3)
42 ne5: !=(>=3)
43
44 s: string
45 n: number
46 i: int
47 f: float
48 b: bytes
49 basic1: <(i)
50 basic2: >(n)
51 basic3: >=(s)
52 basic4: <=(f)
53 basic5: <=(b)
54
55 // Do NOT interpret this the same as `!= type`.
56 bne1: !=(s)
57 bne2: !=(n)
58 bne3: !=(n)
59 bne4: !=(i)
60 bne5: !=(b)
61
62 e1: <(=~"foo")
63 e2: >(null)
64}
65-- out/eval/stats --
66Leaks: 0
67Freed: 53
68Reused: 50
69Allocs: 3
70Retain: 1
71
72Unifications: 53
73Conjuncts: 110
74Disjuncts: 54
75-- out/eval --
76Errors:
77simplifyExpr.e2: cannot use null for bound >:
78 ./in.cue:62:8
79
80Result:
81(_|_){
82 // [eval]
83 x0: (int){ 5 }
84 x1: (int){ 30 }
85 b0: (number){ &(>0, <5) }
86 b1: (int){ &(>0, <5, int) }
87 b2: (int){ &(<5.5, int) }
88 b3: (number){ <=5 }
89 b4: (number){ >20 }
90 b5: (number){ >=21 }
91 b6: (int){ 6 }
92 simplifyExpr: (_|_){
93 // [eval]
94 less1: (number){ <3 }
95 less2: (number){ <3 }
96 less3: (number){ <3 }
97 less4: (number){ <=3 }
98 less5: (number){ number }
99 less6: (number){ number }
100 gtr1: (number){ >3 }
101 gtr2: (number){ >3 }
102 gtr3: (number){ >3 }
103 gtr4: (number){ >=3 }
104 gtr5: (number){ number }
105 gtr6: (number){ number }
106 lg1: (number){ number }
107 lg2: (number){ number }
108 lg3: (number){ number }
109 lg4: (number){ number }
110 gl1: (number){ number }
111 gl2: (number){ number }
112 gl3: (number){ number }
113 gl4: (number){ number }
114 ne1: (int){ 3 }
115 ne2: (number){ >=3 }
116 ne3: (number){ >3 }
117 ne4: (number){ <=3 }
118 ne5: (number){ <3 }
119 s: (string){ string }
120 n: (number){ number }
121 i: (int){ int }
122 f: (float){ float }
123 b: (bytes){ bytes }
124 basic1: (_|_){
125 // [incomplete] simplifyExpr.basic1: non-concrete value i for bound <:
126 // ./in.cue:48:12
127 }
128 basic2: (_|_){
129 // [incomplete] simplifyExpr.basic2: non-concrete value n for bound >:
130 // ./in.cue:49:12
131 }
132 basic3: (_|_){
133 // [incomplete] simplifyExpr.basic3: non-concrete value s for bound >=:
134 // ./in.cue:50:13
135 }
136 basic4: (_|_){
137 // [incomplete] simplifyExpr.basic4: non-concrete value f for bound <=:
138 // ./in.cue:51:13
139 }
140 basic5: (_|_){
141 // [incomplete] simplifyExpr.basic5: non-concrete value b for bound <=:
142 // ./in.cue:52:13
143 }
144 bne1: (_|_){
145 // [incomplete] simplifyExpr.bne1: non-concrete value s for bound !=:
146 // ./in.cue:55:11
147 }
148 bne2: (_|_){
149 // [incomplete] simplifyExpr.bne2: non-concrete value n for bound !=:
150 // ./in.cue:56:11
151 }
152 bne3: (_|_){
153 // [incomplete] simplifyExpr.bne3: non-concrete value n for bound !=:
154 // ./in.cue:57:11
155 }
156 bne4: (_|_){
157 // [incomplete] simplifyExpr.bne4: non-concrete value i for bound !=:
158 // ./in.cue:58:11
159 }
160 bne5: (_|_){
161 // [incomplete] simplifyExpr.bne5: non-concrete value b for bound !=:
162 // ./in.cue:59:11
163 }
164 e1: (_|_){
165 // [incomplete] simplifyExpr.e1: non-concrete value =~"foo" for bound <:
166 // ./in.cue:61:8
167 }
168 e2: (_|_){
169 // [eval] simplifyExpr.e2: cannot use null for bound >:
170 // ./in.cue:62:8
171 }
172 }
173}
174-- out/compile --
175--- in.cue
176{
177 x0: 5
178 x1: (〈0;b5〉 & 30)
179 b0: (<〈0;x0〉 & >0)
180 b1: (〈0;b0〉 & int)
181 b2: (int & <5.5)
182 b3: (<10 & <=5)
183 b4: (>=20 & >20)
184 b5: (>=21 & >20)
185 b6: ((int & >5) & <=6)
186 simplifyExpr: {
187 less1: <<3
188 less2: <<=3
189 less3: <=<3
190 less4: <=<=3
191 less5: <!=3
192 less6: <=!=3
193 gtr1: >>3
194 gtr2: >>=3
195 gtr3: >=>3
196 gtr4: >=>=3
197 gtr5: >!=3
198 gtr6: >=!=3
199 lg1: <>3
200 lg2: <>=3
201 lg3: <=>3
202 lg4: <=>=3
203 gl1: ><3
204 gl2: ><=3
205 gl3: >=<3
206 gl4: >=<=3
207 ne1: !=!=3
208 ne2: !=<3
209 ne3: !=<=3
210 ne4: !=>3
211 ne5: !=>=3
212 s: string
213 n: number
214 i: int
215 f: float
216 b: bytes
217 basic1: <〈0;i〉
218 basic2: >〈0;n〉
219 basic3: >=〈0;s〉
220 basic4: <=〈0;f〉
221 basic5: <=〈0;b〉
222 bne1: !=〈0;s〉
223 bne2: !=〈0;n〉
224 bne3: !=〈0;n〉
225 bne4: !=〈0;i〉
226 bne5: !=〈0;b〉
227 e1: <=~"foo"
228 e2: >null
229 }
230}
View as plain text