Skip to content

Commit 2cd5ba6

Browse files
committed
internal/core/adt: reset embedding scopes for subfields
Embedding scopes should not be carried over to subfields. This changes resets them. The change to bulk.txtar seems to be an improvement. Fixes #3834 Fixes #3837 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I35f9703d328e6cb4babf7cc5e1efb4610392fbb8 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211951 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 413d39a commit 2cd5ba6

File tree

5 files changed

+146
-281
lines changed

5 files changed

+146
-281
lines changed

cue/testdata/definitions/issue3834.txtar

+63-147
Original file line numberDiff line numberDiff line change
@@ -121,27 +121,15 @@ Disjuncts: 237
121121
concrete: (struct){
122122
}
123123
}
124-
_a: (struct){ |((struct){
125-
foo: (bool){ true }
126-
}, (#struct){
127-
foo: (bool){ true }
128-
y!: (struct){
129-
z?: (_){ _ }
130-
}
131-
}) }
132-
_b: (struct){ |((struct){
133-
y: (struct){
134-
}
135-
foo: (bool){ true }
136-
}, (#struct){
137-
y: (struct){
138-
z?: (_){ _ }
139-
}
140-
foo: (bool){ true }
141-
}) }
142-
concrete: (_|_){
143-
// [incomplete] sub.t2.concrete: unresolved disjunction {y:{},foo:true} | {y:{z?:_},foo:true} (type struct):
144-
// ./in.cue:25:13
124+
_a: (struct){
125+
foo: (bool){ true }
126+
}
127+
_b: (struct){
128+
y: (struct){
129+
}
130+
foo: (bool){ true }
131+
}
132+
concrete: (struct){
145133
}
146134
}
147135
t3: (#struct){
@@ -181,27 +169,15 @@ Disjuncts: 237
181169
concrete: (#struct){
182170
}
183171
}
184-
_a: (#struct){ |((#struct){
185-
foo: (bool){ true }
186-
}, (#struct){
187-
foo: (bool){ true }
188-
y!: (#struct){
189-
z?: (_){ _ }
190-
}
191-
}) }
192-
_b: (#struct){ |((#struct){
193-
y: (#struct){
194-
}
195-
foo: (bool){ true }
196-
}, (#struct){
197-
y: (#struct){
198-
z?: (_){ _ }
199-
}
200-
foo: (bool){ true }
201-
}) }
202-
concrete: (_|_){
203-
// [incomplete] sub.t4.concrete: unresolved disjunction {y:{},foo:true} | {y:{z?:_},foo:true} (type struct):
204-
// ./in.cue:43:13
172+
_a: (#struct){
173+
foo: (bool){ true }
174+
}
175+
_b: (#struct){
176+
y: (#struct){
177+
}
178+
foo: (bool){ true }
179+
}
180+
concrete: (#struct){
205181
}
206182
}
207183
}
@@ -227,29 +203,17 @@ Disjuncts: 237
227203
}
228204
out: (bool){ true }
229205
}
230-
_a: (struct){ |((struct){
231-
foo: (bool){ true }
232-
}, (#struct){
233-
foo: (bool){ true }
234-
y!: (struct){
235-
z?: (_){ _ }
236-
}
237-
}) }
238-
_b: (struct){ |((struct){
239-
y: (struct){
240-
}
241-
foo: (bool){ true }
242-
}, (#struct){
243-
y: (struct){
244-
z?: (_){ _ }
245-
}
246-
foo: (bool){ true }
247-
}) }
248-
concrete: (_|_){
249-
// [incomplete] concrete: unresolved disjunction {y:{},foo:true} | {y:{z?:_},foo:true} (type struct):
250-
// ./in.cue:6:12
206+
_a: (struct){
207+
foo: (bool){ true }
208+
}
209+
_b: (struct){
210+
y: (struct){
211+
}
212+
foo: (bool){ true }
213+
}
214+
concrete: (struct){
251215
}
252-
isTrue: (bool){ false }
216+
isTrue: (bool){ true }
253217
}
254218
-- diff/-out/evalalpha<==>+out/eval --
255219
diff old new
@@ -260,10 +224,8 @@ diff old new
260224
}
261225
_b: (struct){
262226
- foo: (bool){ true }
263-
- y: (struct){
264-
- }
265-
+ y: (struct){
266-
+ }
227+
y: (struct){
228+
}
267229
+ foo: (bool){ true }
268230
}
269231
concrete: (struct){
@@ -319,7 +281,7 @@ diff old new
319281
}
320282
concrete: (struct){
321283
}
322-
@@ -54,22 +43,34 @@
284+
@@ -54,20 +43,20 @@
323285
foo: (bool){ true }
324286
}
325287
_b: (struct){
@@ -337,40 +299,24 @@ diff old new
337299
- foo: (bool){ true }
338300
- y: (struct){
339301
- }
340-
- }
341-
- concrete: (struct){
342302
+ y: (struct){
343303
+ }
344304
+ foo: (bool){ true }
345305
+ }
346306
+ concrete: (struct){
347307
+ }
348308
+ }
349-
+ _a: (struct){ |((struct){
350-
+ foo: (bool){ true }
351-
+ }, (#struct){
352-
+ foo: (bool){ true }
353-
+ y!: (struct){
354-
+ z?: (_){ _ }
355-
+ }
356-
+ }) }
357-
+ _b: (struct){ |((struct){
358-
+ y: (struct){
359-
+ }
360-
+ foo: (bool){ true }
361-
+ }, (#struct){
362-
+ y: (struct){
363-
+ z?: (_){ _ }
364-
+ }
365-
+ foo: (bool){ true }
366-
+ }) }
367-
+ concrete: (_|_){
368-
+ // [incomplete] sub.t2.concrete: unresolved disjunction {y:{},foo:true} | {y:{z?:_},foo:true} (type struct):
369-
+ // ./in.cue:25:13
309+
+ _a: (struct){
310+
+ foo: (bool){ true }
311+
+ }
312+
+ _b: (struct){
313+
+ y: (struct){
314+
+ }
315+
+ foo: (bool){ true }
370316
}
371-
}
372-
t3: (#struct){
373-
@@ -78,20 +79,20 @@
317+
concrete: (struct){
318+
}
319+
@@ -78,20 +67,20 @@
374320
foo: (bool){ true }
375321
}
376322
_b: (#struct){
@@ -405,7 +351,7 @@ diff old new
405351
}
406352
concrete: (#struct){
407353
}
408-
@@ -102,22 +103,34 @@
354+
@@ -102,20 +91,20 @@
409355
foo: (bool){ true }
410356
}
411357
_b: (#struct){
@@ -423,40 +369,24 @@ diff old new
423369
- foo: (bool){ true }
424370
- y: (#struct){
425371
- }
426-
- }
427-
- concrete: (#struct){
428372
+ y: (#struct){
429373
+ }
430374
+ foo: (bool){ true }
431375
+ }
432376
+ concrete: (#struct){
433377
+ }
434378
+ }
435-
+ _a: (#struct){ |((#struct){
436-
+ foo: (bool){ true }
437-
+ }, (#struct){
438-
+ foo: (bool){ true }
439-
+ y!: (#struct){
440-
+ z?: (_){ _ }
441-
+ }
442-
+ }) }
443-
+ _b: (#struct){ |((#struct){
444-
+ y: (#struct){
445-
+ }
446-
+ foo: (bool){ true }
447-
+ }, (#struct){
448-
+ y: (#struct){
449-
+ z?: (_){ _ }
450-
+ }
451-
+ foo: (bool){ true }
452-
+ }) }
453-
+ concrete: (_|_){
454-
+ // [incomplete] sub.t4.concrete: unresolved disjunction {y:{},foo:true} | {y:{z?:_},foo:true} (type struct):
455-
+ // ./in.cue:43:13
379+
+ _a: (#struct){
380+
+ foo: (bool){ true }
381+
+ }
382+
+ _b: (#struct){
383+
+ y: (#struct){
384+
+ }
385+
+ foo: (bool){ true }
456386
}
457-
}
458-
}
459-
@@ -127,9 +140,9 @@
387+
concrete: (#struct){
388+
}
389+
@@ -127,9 +116,9 @@
460390
Foo: (bool){ true }
461391
}
462392
_dataWithExtra: (#struct){
@@ -467,7 +397,7 @@ diff old new
467397
}
468398
out: (bool){ true }
469399
}
470-
@@ -137,10 +150,33 @@
400+
@@ -137,10 +126,21 @@
471401
Foo: (bool){ true }
472402
}
473403
_dataWithExtra: (#struct){
@@ -478,32 +408,18 @@ diff old new
478408
}
479409
out: (bool){ true }
480410
}
481-
+ _a: (struct){ |((struct){
482-
+ foo: (bool){ true }
483-
+ }, (#struct){
484-
+ foo: (bool){ true }
485-
+ y!: (struct){
486-
+ z?: (_){ _ }
487-
+ }
488-
+ }) }
489-
+ _b: (struct){ |((struct){
490-
+ y: (struct){
491-
+ }
492-
+ foo: (bool){ true }
493-
+ }, (#struct){
494-
+ y: (struct){
495-
+ z?: (_){ _ }
496-
+ }
497-
+ foo: (bool){ true }
498-
+ }) }
499-
+ concrete: (_|_){
500-
+ // [incomplete] concrete: unresolved disjunction {y:{},foo:true} | {y:{z?:_},foo:true} (type struct):
501-
+ // ./in.cue:6:12
411+
+ _a: (struct){
412+
+ foo: (bool){ true }
413+
+ }
414+
+ _b: (struct){
415+
+ y: (struct){
416+
+ }
417+
+ foo: (bool){ true }
418+
+ }
419+
+ concrete: (struct){
502420
+ }
503-
+ isTrue: (bool){ false }
421+
+ isTrue: (bool){ true }
504422
}
505-
-- diff/todo/p1 --
506-
*.concrete: several fields where there is still an disjunction
507423
-- out/eval --
508424
(struct){
509425
X: (struct){

0 commit comments

Comments
 (0)