...
1# DO NOT EDIT; generated by go run testdata/gen.go
2#
3#name: combined definitions
4#evalPartial
5-- in.cue --
6// Allow combining of structs within a definition
7#D1: {
8 env: a: "A"
9 env: b: "B"
10 #def: {a: "A"}
11 #def: {b: "B"}
12}
13
14d1: #D1 & {env: c: "C"}
15
16#D2: {
17 a: int
18}
19#D2: {
20 b: int
21}
22
23#D3: {
24 env: a: "A"
25}
26#D3: {
27 env: b: "B"
28}
29
30#D4: {
31 env: #DC
32 env: b: int
33}
34
35#DC: {a: int}
36-- out/def --
37// Allow combining of structs within a definition
38#D1: {
39 env: {
40 a: "A"
41 b: "B"
42 }
43 #def: {
44 a: "A"
45 b: "B"
46 }
47}
48d1: #D1 & {
49 env: {
50 c: "C"
51 }
52}
53#D2: {
54 a: int
55 b: int
56}
57#D3: {
58 env: {
59 a: "A"
60 b: "B"
61 }
62}
63#D4: {
64 env: _|_ // field "b" not allowed in closed struct
65}
66#DC: {
67 a: int
68}
69-- out/legacy-debug --
70<0>{#D1: <1>C{env: <2>C{a: "A", b: "B"}, #def: <3>C{a: "A", b: "B"}}, d1: <4>C{env: _|_("C":field "c" not allowed in closed struct), #def: <5>C{a: "A", b: "B"}}, #D2: <6>C{a: int, b: int}, #D3: <7>C{env: <8>C{a: "A", b: "B"}}, #D4: <9>C{env: _|_(int:field "b" not allowed in closed struct)}, #DC: <10>C{a: int}}
71-- out/compile --
72--- in.cue
73{
74 #D1: {
75 env: {
76 a: "A"
77 }
78 env: {
79 b: "B"
80 }
81 #def: {
82 a: "A"
83 }
84 #def: {
85 b: "B"
86 }
87 }
88 d1: (ă0;#D1ă & {
89 env: {
90 c: "C"
91 }
92 })
93 #D2: {
94 a: int
95 }
96 #D2: {
97 b: int
98 }
99 #D3: {
100 env: {
101 a: "A"
102 }
103 }
104 #D3: {
105 env: {
106 b: "B"
107 }
108 }
109 #D4: {
110 env: ă1;#DCă
111 env: {
112 b: int
113 }
114 }
115 #DC: {
116 a: int
117 }
118}
119-- out/eval/stats --
120Leaks: 0
121Freed: 29
122Reused: 24
123Allocs: 5
124Retain: 1
125
126Unifications: 29
127Conjuncts: 41
128Disjuncts: 30
129-- out/evalalpha --
130Errors:
131d1.env.c: field not allowed:
132 ./in.cue:9:17
133#D4.env.b: field not allowed:
134 ./in.cue:26:7
135 ./in.cue:27:7
136
137Result:
138(_|_){
139 // [eval]
140 #D1: (#struct){
141 env: (#struct){
142 a: (string){ "A" }
143 b: (string){ "B" }
144 }
145 #def: (#struct){
146 a: (string){ "A" }
147 b: (string){ "B" }
148 }
149 }
150 d1: (_|_){
151 // [eval]
152 env: (_|_){
153 // [eval]
154 c: (_|_){
155 // [eval] d1.env.c: field not allowed:
156 // ./in.cue:9:17
157 }
158 a: (string){ "A" }
159 b: (string){ "B" }
160 }
161 #def: (#struct){
162 a: (string){ "A" }
163 b: (string){ "B" }
164 }
165 }
166 #D2: (#struct){
167 a: (int){ int }
168 b: (int){ int }
169 }
170 #D3: (#struct){
171 env: (#struct){
172 a: (string){ "A" }
173 b: (string){ "B" }
174 }
175 }
176 #D4: (_|_){
177 // [eval]
178 env: (_|_){
179 // [eval]
180 b: (_|_){
181 // [eval] #D4.env.b: field not allowed:
182 // ./in.cue:26:7
183 // ./in.cue:27:7
184 }
185 a: (int){ int }
186 }
187 }
188 #DC: (#struct){
189 a: (int){ int }
190 }
191}
192-- diff/-out/evalalpha<==>+out/eval --
193diff old new
194--- old
195+++ new
196@@ -1,13 +1,9 @@
197 Errors:
198+d1.env.c: field not allowed:
199+ ./in.cue:9:17
200 #D4.env.b: field not allowed:
201 ./in.cue:26:7
202 ./in.cue:27:7
203- ./in.cue:30:6
204-d1.env.c: field not allowed:
205- ./in.cue:3:7
206- ./in.cue:4:7
207- ./in.cue:9:5
208- ./in.cue:9:17
209
210 Result:
211 (_|_){
212@@ -26,15 +22,12 @@
213 // [eval]
214 env: (_|_){
215 // [eval]
216- a: (string){ "A" }
217- b: (string){ "B" }
218 c: (_|_){
219 // [eval] d1.env.c: field not allowed:
220- // ./in.cue:3:7
221- // ./in.cue:4:7
222- // ./in.cue:9:5
223 // ./in.cue:9:17
224 }
225+ a: (string){ "A" }
226+ b: (string){ "B" }
227 }
228 #def: (#struct){
229 a: (string){ "A" }
230@@ -55,13 +48,12 @@
231 // [eval]
232 env: (_|_){
233 // [eval]
234- a: (int){ int }
235 b: (_|_){
236 // [eval] #D4.env.b: field not allowed:
237 // ./in.cue:26:7
238 // ./in.cue:27:7
239- // ./in.cue:30:6
240- }
241+ }
242+ a: (int){ int }
243 }
244 }
245 #DC: (#struct){
246-- diff/todo/p2 --
247Missing positions
248-- diff/todo/p3 --
249Reordering
250-- out/eval --
251Errors:
252#D4.env.b: field not allowed:
253 ./in.cue:26:7
254 ./in.cue:27:7
255 ./in.cue:30:6
256d1.env.c: field not allowed:
257 ./in.cue:3:7
258 ./in.cue:4:7
259 ./in.cue:9:5
260 ./in.cue:9:17
261
262Result:
263(_|_){
264 // [eval]
265 #D1: (#struct){
266 env: (#struct){
267 a: (string){ "A" }
268 b: (string){ "B" }
269 }
270 #def: (#struct){
271 a: (string){ "A" }
272 b: (string){ "B" }
273 }
274 }
275 d1: (_|_){
276 // [eval]
277 env: (_|_){
278 // [eval]
279 a: (string){ "A" }
280 b: (string){ "B" }
281 c: (_|_){
282 // [eval] d1.env.c: field not allowed:
283 // ./in.cue:3:7
284 // ./in.cue:4:7
285 // ./in.cue:9:5
286 // ./in.cue:9:17
287 }
288 }
289 #def: (#struct){
290 a: (string){ "A" }
291 b: (string){ "B" }
292 }
293 }
294 #D2: (#struct){
295 a: (int){ int }
296 b: (int){ int }
297 }
298 #D3: (#struct){
299 env: (#struct){
300 a: (string){ "A" }
301 b: (string){ "B" }
302 }
303 }
304 #D4: (_|_){
305 // [eval]
306 env: (_|_){
307 // [eval]
308 a: (int){ int }
309 b: (_|_){
310 // [eval] #D4.env.b: field not allowed:
311 // ./in.cue:26:7
312 // ./in.cue:27:7
313 // ./in.cue:30:6
314 }
315 }
316 }
317 #DC: (#struct){
318 a: (int){ int }
319 }
320}
View as plain text