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