...
1# DO NOT EDIT; generated by go run testdata/gen.go
2#
3#name: builtins
4#evalPartial
5-- in.cue --
6import (
7 "list"
8 "strings"
9)
10
11a1: {
12 a: and([b, c])
13 b: =~"oo"
14 c: =~"fo"
15}
16a2: a1 & {a: "foo"}
17a3: a1 & {a: "bar"}
18
19o1: {
20 a: or([b, c])
21 b: string
22 c: "bar"
23}
24o2: o1 & {a: "foo"}
25o3: o1 & {a: "foo", b: "baz"}
26
27// Issue #585
28stringListErrors: {
29 a: {
30 x: [string, ...string]
31 result: strings.Join(x, " ")
32 }
33
34 b: {
35 x: [int, ...string]
36 result: strings.Join(x, " ")
37 }
38
39 c: {
40 x: []
41 result: strings.Join(x, int)
42 }
43}
44
45decimalListErrors: {
46 a: {
47 x: [string]
48 result: list.Avg(x)
49 }
50
51 b: {
52 x: [int, ...string]
53 result: list.Avg(x)
54 }
55}
56-- out/def --
57a1: {
58 a: =~"oo" & =~"fo"
59 b: =~"oo"
60 c: =~"fo"
61}
62a2: a1 & {
63 a: "foo"
64}
65a3: a1 & {
66 a: "bar"
67}
68o1: {
69 a: string
70 b: string
71 c: "bar"
72}
73o2: o1 & {
74 a: "foo"
75}
76o3: o1 & {
77 a: "foo"
78 b: "baz"
79}
80-- out/legacy-debug --
81<0>{a1: <1>{a: (=~"oo" & =~"fo"), b: =~"oo", c: =~"fo"}, a2: <2>{a: "foo", b: =~"oo", c: =~"fo"}, a3: <3>{a: _|_((=~"oo" & "bar"):invalid value "bar" (does not match =~"oo")), b: =~"oo", c: =~"fo"}, o1: <4>{a: string, b: string, c: "bar"}, o2: <5>{a: "foo", b: string, c: "bar"}, o3: <6>{a: _|_(("baz" & "foo"):empty disjunction: conflicting values "baz" and "foo";("bar" & "foo"):empty disjunction: conflicting values "bar" and "foo"), b: "baz", c: "bar"}}
82-- out/eval/stats --
83Leaks: 6
84Freed: 61
85Reused: 53
86Allocs: 14
87Retain: 22
88
89Unifications: 55
90Conjuncts: 125
91Disjuncts: 75
92-- out/eval --
93Errors:
94o3.a: 2 errors in empty disjunction:
95o3.a: conflicting values "bar" and "foo":
96 ./in.cue:15:12
97 ./in.cue:17:5
98 ./in.cue:20:5
99 ./in.cue:20:14
100o3.a: conflicting values "baz" and "foo":
101 ./in.cue:15:9
102 ./in.cue:20:5
103 ./in.cue:20:14
104 ./in.cue:20:24
105a3.a: invalid value "bar" (out of bound =~"oo"):
106 ./in.cue:8:5
107 ./in.cue:7:5
108 ./in.cue:12:14
109a3.a: invalid value "bar" (out of bound =~"fo"):
110 ./in.cue:9:5
111 ./in.cue:7:5
112 ./in.cue:12:14
113stringListErrors.b.result: invalid list element 0 in argument 0 to call: cannot use value int (int) as string:
114 ./in.cue:31:11
115 ./in.cue:30:7
116stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join:
117 ./in.cue:36:27
118decimalListErrors.a.result: invalid list element 0 in argument 0 to call: cannot use value string (string) as number:
119 ./in.cue:43:11
120 ./in.cue:42:7
121
122Result:
123(_|_){
124 // [eval]
125 a1: (struct){
126 a: (string){ &(=~"oo", =~"fo") }
127 b: (string){ =~"oo" }
128 c: (string){ =~"fo" }
129 }
130 a2: (struct){
131 a: (string){ "foo" }
132 b: (string){ =~"oo" }
133 c: (string){ =~"fo" }
134 }
135 a3: (_|_){
136 // [eval]
137 a: (_|_){
138 // [eval] a3.a: invalid value "bar" (out of bound =~"oo"):
139 // ./in.cue:8:5
140 // ./in.cue:7:5
141 // ./in.cue:12:14
142 // a3.a: invalid value "bar" (out of bound =~"fo"):
143 // ./in.cue:9:5
144 // ./in.cue:7:5
145 // ./in.cue:12:14
146 }
147 b: (string){ =~"oo" }
148 c: (string){ =~"fo" }
149 }
150 o1: (struct){
151 a: (string){ |((string){ string }, (string){ "bar" }) }
152 b: (string){ string }
153 c: (string){ "bar" }
154 }
155 o2: (struct){
156 a: (string){ "foo" }
157 b: (string){ string }
158 c: (string){ "bar" }
159 }
160 o3: (_|_){
161 // [eval]
162 a: (_|_){
163 // [eval] o3.a: 2 errors in empty disjunction:
164 // o3.a: conflicting values "bar" and "foo":
165 // ./in.cue:15:12
166 // ./in.cue:17:5
167 // ./in.cue:20:5
168 // ./in.cue:20:14
169 // o3.a: conflicting values "baz" and "foo":
170 // ./in.cue:15:9
171 // ./in.cue:20:5
172 // ./in.cue:20:14
173 // ./in.cue:20:24
174 }
175 b: (string){ "baz" }
176 c: (string){ "bar" }
177 }
178 stringListErrors: (_|_){
179 // [eval]
180 a: (struct){
181 x: (list){
182 0: (string){ string }
183 }
184 result: (_|_){
185 // [incomplete] stringListErrors.a.result: non-concrete value string for element 0 of string list argument 0:
186 // ./in.cue:26:11
187 // ./in.cue:25:7
188 }
189 }
190 b: (_|_){
191 // [eval]
192 x: (list){
193 0: (int){ int }
194 }
195 result: (_|_){
196 // [eval] stringListErrors.b.result: invalid list element 0 in argument 0 to call: cannot use value int (int) as string:
197 // ./in.cue:31:11
198 // ./in.cue:30:7
199 }
200 }
201 c: (_|_){
202 // [eval]
203 x: (#list){
204 }
205 result: (_|_){
206 // [eval] stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join:
207 // ./in.cue:36:27
208 }
209 }
210 }
211 decimalListErrors: (_|_){
212 // [eval]
213 a: (_|_){
214 // [eval]
215 x: (#list){
216 0: (string){ string }
217 }
218 result: (_|_){
219 // [eval] decimalListErrors.a.result: invalid list element 0 in argument 0 to call: cannot use value string (string) as number:
220 // ./in.cue:43:11
221 // ./in.cue:42:7
222 }
223 }
224 b: (struct){
225 x: (list){
226 0: (int){ int }
227 }
228 result: (_|_){
229 // [incomplete] decimalListErrors.b.result: non-concrete value int for element 0 of number list argument 0:
230 // ./in.cue:48:11
231 // ./in.cue:47:7
232 }
233 }
234 }
235}
236-- out/compile --
237--- in.cue
238{
239 a1: {
240 a: and([
241 〈1;b〉,
242 〈1;c〉,
243 ])
244 b: =~"oo"
245 c: =~"fo"
246 }
247 a2: (〈0;a1〉 & {
248 a: "foo"
249 })
250 a3: (〈0;a1〉 & {
251 a: "bar"
252 })
253 o1: {
254 a: or([
255 〈1;b〉,
256 〈1;c〉,
257 ])
258 b: string
259 c: "bar"
260 }
261 o2: (〈0;o1〉 & {
262 a: "foo"
263 })
264 o3: (〈0;o1〉 & {
265 a: "foo"
266 b: "baz"
267 })
268 stringListErrors: {
269 a: {
270 x: [
271 string,
272 ...string,
273 ]
274 result: 〈import;strings〉.Join(〈0;x〉, " ")
275 }
276 b: {
277 x: [
278 int,
279 ...string,
280 ]
281 result: 〈import;strings〉.Join(〈0;x〉, " ")
282 }
283 c: {
284 x: []
285 result: 〈import;strings〉.Join(〈0;x〉, int)
286 }
287 }
288 decimalListErrors: {
289 a: {
290 x: [
291 string,
292 ]
293 result: 〈import;list〉.Avg(〈0;x〉)
294 }
295 b: {
296 x: [
297 int,
298 ...string,
299 ]
300 result: 〈import;list〉.Avg(〈0;x〉)
301 }
302 }
303}
View as plain text