Skip to content

Commit e12d544

Browse files
committed
internal/core/adt: partial revert of fixes for 3919
We removed a piece of code which seemingly was redundant after the fix for 3919. It turns out, though, that it is still necessary in some cases. Reverting it did not affect the results of 3919 except one change in an error message, which is now what it was before the change for 3919. Issue #3919 Fixes #3931 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I4d8657e3b3c85ab67e60684d3726c6f819e296f3 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1215499 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent cff2d7e commit e12d544

File tree

3 files changed

+22
-71
lines changed

3 files changed

+22
-71
lines changed

cue/testdata/eval/comprehensions.txtar

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,8 @@ Result:
271271
// [eval] issue3691.structuralCycle.a.b.c: conflicting values string and {[string]:X} (mismatched types string and struct):
272272
// ./issue3691.cue:14:15
273273
// ./issue3691.cue:15:5
274-
b*: (_|_){// [e]if true {
275-
// c: 〈3;a〉
276-
// }[e] & 〈1;X〉
274+
b: (_|_){
275+
// [cycle] cycle error
277276
}
278277
}
279278
}
@@ -308,20 +307,18 @@ diff old new
308307
// ./issue3691.cue:8:10
309308
}
310309
}
311-
@@ -145,13 +140,9 @@
310+
@@ -145,13 +140,8 @@
312311
// [eval] issue3691.structuralCycle.a.b.c: conflicting values string and {[string]:X} (mismatched types string and struct):
313312
// ./issue3691.cue:14:15
314313
// ./issue3691.cue:15:5
315314
- // ./issue3691.cue:17:3
316315
- // ./issue3691.cue:18:10
317-
- b: (_|_){
316+
b: (_|_){
318317
- // [structural cycle]
319318
- c: (_|_){
320319
- // [structural cycle] issue3691.structuralCycle.a.b.c.b.c: structural cycle
321320
- }
322-
+ b*: (_|_){// [e]if true {
323-
+ // c: 〈3;a〉
324-
+ // }[e] & 〈1;X〉
321+
+ // [cycle] cycle error
325322
}
326323
}
327324
}

cue/testdata/eval/issue3919.txtar

Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,7 @@ Unifications: 47
6464
Conjuncts: 73
6565
Disjuncts: 54
6666
-- out/evalalpha --
67-
Errors:
68-
issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
69-
./let.cue:8:14
70-
71-
Result:
72-
(_|_){
73-
// [eval]
67+
(struct){
7468
full: (struct){
7569
out: (struct){
7670
env: (struct){
@@ -83,19 +77,15 @@ Result:
8377
a: (int){ 30080 }
8478
port: (int){ |(*(int){ 30080 }, (int){ int }) }
8579
}
86-
issue3931: (_|_){
87-
// [eval]
88-
full: (_|_){
89-
// [eval]
90-
bar: (_|_){
91-
// [eval]
92-
bar1: (_|_){
93-
// [eval]
94-
spec: (_|_){
95-
// [eval]
96-
selector: (_|_){
97-
// [eval] issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
98-
// ./let.cue:8:14
80+
issue3931: (struct){
81+
full: (struct){
82+
bar: (struct){
83+
bar1: (struct){
84+
spec: (struct){
85+
selector: (struct){
86+
label: (string){ "foo" }
87+
expr?: (list){
88+
}
9989
}
10090
}
10191
}
@@ -156,48 +146,7 @@ Result:
156146
diff old new
157147
--- old
158148
+++ new
159-
@@ -1,4 +1,10 @@
160-
-(struct){
161-
+Errors:
162-
+issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
163-
+ ./let.cue:8:14
164-
+
165-
+Result:
166-
+(_|_){
167-
+ // [eval]
168-
full: (struct){
169-
out: (struct){
170-
env: (struct){
171-
@@ -11,15 +17,19 @@
172-
a: (int){ 30080 }
173-
port: (int){ |(*(int){ 30080 }, (int){ int }) }
174-
}
175-
- issue3931: (struct){
176-
- full: (struct){
177-
- bar: (struct){
178-
- bar1: (struct){
179-
- spec: (struct){
180-
- selector: (struct){
181-
- label: (string){ "foo" }
182-
- expr?: (list){
183-
- }
184-
+ issue3931: (_|_){
185-
+ // [eval]
186-
+ full: (_|_){
187-
+ // [eval]
188-
+ bar: (_|_){
189-
+ // [eval]
190-
+ bar1: (_|_){
191-
+ // [eval]
192-
+ spec: (_|_){
193-
+ // [eval]
194-
+ selector: (_|_){
195-
+ // [eval] issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
196-
+ // ./let.cue:8:14
197-
}
198-
}
199-
}
200-
@@ -45,10 +55,7 @@
149+
@@ -45,10 +45,7 @@
201150
foo: (struct){
202151
fooData: (struct){
203152
total: (struct){
@@ -209,7 +158,7 @@ diff old new
209158
}
210159
_hidden: (struct){
211160
extra: (struct){
212-
@@ -56,12 +63,7 @@
161+
@@ -56,12 +53,7 @@
213162
}
214163
}
215164
shared: (struct){

internal/core/adt/unify.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ func (v *Vertex) unify(c *OpContext, needs condition, mode runMode, checkTypos b
215215
// forcefully do an early recursive evaluation to decide the state
216216
// of the arc. See https://cuelang.org/issue/3621.
217217
n.process(pendingKnown, yield)
218+
if n.node.ArcType == ArcPending {
219+
for _, a := range n.node.Arcs {
220+
a.unify(c, needs, attemptOnly, checkTypos)
221+
}
222+
}
218223
n.completePending(yield)
219224
}
220225

0 commit comments

Comments
 (0)