Skip to content

Commit 47912fc

Browse files
committed
internal/core/adt: revert 1217228
This caused more harm than good. See https://cuelang.org/cl/1217228 Issue #3977 Open #3977 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Ia5e2ef65a5c8df1b38b6aaeea2c0e0a7fc5feb27 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1217388 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 2bbc359 commit 47912fc

File tree

2 files changed

+19
-108
lines changed

2 files changed

+19
-108
lines changed

cue/testdata/eval/nonrooted.txtar

Lines changed: 12 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,12 @@ Conjuncts: 87
5858
Disjuncts: 68
5959
-- out/evalalpha --
6060
Errors:
61-
issue3977.inlineLet.p.x: conflicting values 1 and 2:
62-
./in.cue:38:14
63-
./in.cue:43:6
64-
x: conflicting values 1 and 2:
65-
./in.cue:2:14
66-
./in.cue:8:18
6761
x: conflicting values 2 and 1:
6862
./in.cue:20:14
6963
./in.cue:26:19
7064
x: conflicting values 4 and 1:
7165
./in.cue:20:14
7266
./in.cue:26:23
73-
x: invalid interpolation: 3 errors in empty disjunction::
74-
./in.cue:14:8
75-
./in.cue:14:17
7667
x: 2 errors in empty disjunction::
7768
./in.cue:23:8
7869

@@ -81,21 +72,15 @@ Result:
8172
// [eval]
8273
issue3977: (_|_){
8374
// [eval]
84-
inlineExpr: (_|_){
85-
// [eval]
75+
inlineExpr: (struct){
8676
#NetworkID: (int){ 1 }
8777
#fn: (#struct){
8878
x: (int){ 1 }
8979
out: (int){ 2 }
9080
}
91-
err: (_|_){
92-
// [eval] x: conflicting values 1 and 2:
93-
// ./in.cue:2:14
94-
// ./in.cue:8:18
95-
}
81+
err: (int){ 3 }
9682
}
97-
inlineDisj1: (_|_){
98-
// [eval]
83+
inlineDisj1: (struct){
9984
#NetworkID: (string){ |((string){ "2" }, (string){ "3" }, (string){ "4" }) }
10085
#fn: (#struct){
10186
x: (string){ |((string){ "2" }, (string){ "3" }, (string){ "4" }) }
@@ -104,11 +89,7 @@ Result:
10489
// ./in.cue:14:8
10590
}
10691
}
107-
err: (_|_){
108-
// [eval] x: invalid interpolation: 3 errors in empty disjunction::
109-
// ./in.cue:14:8
110-
// ./in.cue:14:17
111-
}
92+
err: (string){ "value=invalid" }
11293
}
11394
inlineDisj2: (_|_){
11495
// [eval]
@@ -136,8 +117,7 @@ Result:
136117
}
137118
err: (int){ 11 }
138119
}
139-
inlineLet: (_|_){
140-
// [eval]
120+
inlineLet: (struct){
141121
#NetworkID: (int){ 1 }
142122
let p#1 = (_|_){
143123
// [eval]
@@ -152,26 +132,16 @@ Result:
152132
// ./in.cue:43:6
153133
}
154134
}
155-
err: (_|_){
156-
// [eval] issue3977.inlineLet.p.x: conflicting values 1 and 2:
157-
// ./in.cue:38:14
158-
// ./in.cue:43:6
159-
}
135+
err: (int){ 12 }
160136
}
161137
}
162138
}
163139
-- diff/-out/evalalpha<==>+out/eval --
164140
diff old new
165141
--- old
166142
+++ new
167-
@@ -1,14 +1,19 @@
143+
@@ -1,13 +1,9 @@
168144
Errors:
169-
+issue3977.inlineLet.p.x: conflicting values 1 and 2:
170-
+ ./in.cue:38:14
171-
+ ./in.cue:43:6
172-
+x: conflicting values 1 and 2:
173-
+ ./in.cue:2:14
174-
+ ./in.cue:8:18
175145
x: conflicting values 2 and 1:
176146
./in.cue:20:14
177147
- ./in.cue:22:8
@@ -182,52 +152,9 @@ diff old new
182152
- ./in.cue:22:8
183153
- ./in.cue:26:8
184154
./in.cue:26:23
185-
+x: invalid interpolation: 3 errors in empty disjunction::
186-
+ ./in.cue:14:8
187-
+ ./in.cue:14:17
188155
x: 2 errors in empty disjunction::
189156
./in.cue:23:8
190-
191-
@@ -17,15 +22,21 @@
192-
// [eval]
193-
issue3977: (_|_){
194-
// [eval]
195-
- inlineExpr: (struct){
196-
+ inlineExpr: (_|_){
197-
+ // [eval]
198-
#NetworkID: (int){ 1 }
199-
#fn: (#struct){
200-
x: (int){ 1 }
201-
out: (int){ 2 }
202-
}
203-
- err: (int){ 3 }
204-
- }
205-
- inlineDisj1: (struct){
206-
+ err: (_|_){
207-
+ // [eval] x: conflicting values 1 and 2:
208-
+ // ./in.cue:2:14
209-
+ // ./in.cue:8:18
210-
+ }
211-
+ }
212-
+ inlineDisj1: (_|_){
213-
+ // [eval]
214-
#NetworkID: (string){ |((string){ "2" }, (string){ "3" }, (string){ "4" }) }
215-
#fn: (#struct){
216-
x: (string){ |((string){ "2" }, (string){ "3" }, (string){ "4" }) }
217-
@@ -34,7 +45,11 @@
218-
// ./in.cue:14:8
219-
}
220-
}
221-
- err: (string){ "value=invalid" }
222-
+ err: (_|_){
223-
+ // [eval] x: invalid interpolation: 3 errors in empty disjunction::
224-
+ // ./in.cue:14:8
225-
+ // ./in.cue:14:17
226-
+ }
227-
}
228-
inlineDisj2: (_|_){
229-
// [eval]
230-
@@ -46,13 +61,9 @@
157+
@@ -46,13 +42,9 @@
231158
err: (_|_){
232159
// [eval] x: conflicting values 2 and 1:
233160
// ./in.cue:20:14
@@ -241,14 +168,7 @@ diff old new
241168
// ./in.cue:26:23
242169
// x: 2 errors in empty disjunction::
243170
// ./in.cue:23:8
244-
@@ -66,24 +77,27 @@
245-
}
246-
err: (int){ 11 }
247-
}
248-
- inlineLet: (struct){
249-
+ inlineLet: (_|_){
250-
+ // [eval]
251-
#NetworkID: (int){ 1 }
171+
@@ -71,15 +63,13 @@
252172
let p#1 = (_|_){
253173
// [eval]
254174
x: (_|_){
@@ -261,28 +181,16 @@ diff old new
261181
- // [eval] issue3977.inlineLet.p.x: conflicting values 2 and 1:
262182
- // ./in.cue:38:14
263183
- // ./in.cue:40:8
264-
- // ./in.cue:43:6
265-
- }
266-
- }
267-
- err: (int){ 12 }
268184
+ // [eval] issue3977.inlineLet.p.x: conflicting values 1 and 2:
269185
+ // ./in.cue:38:14
270186
+ // ./in.cue:43:6
271187
+ }
272188
+ out: (_|_){
273189
+ // [eval] issue3977.inlineLet.p.x: conflicting values 1 and 2:
274190
+ // ./in.cue:38:14
275-
+ // ./in.cue:43:6
276-
+ }
277-
+ }
278-
+ err: (_|_){
279-
+ // [eval] issue3977.inlineLet.p.x: conflicting values 1 and 2:
280-
+ // ./in.cue:38:14
281-
+ // ./in.cue:43:6
282-
+ }
283-
}
284-
}
285-
}
191+
// ./in.cue:43:6
192+
}
193+
}
286194
-- diff/explanation --
287195
evalv3 correctly fails on all places marked with "err"
288196
-- out/eval --

internal/core/adt/context.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,10 +706,13 @@ func (c *OpContext) evalStateCI(v Expr, state combinedFlags) (result Value, ci C
706706
if arc == nil {
707707
return nil, c.ci
708708
}
709-
if arc.Internal() && c.isDevVersion() {
710-
mode := state.conditions()
711-
state = final(partial, mode|allTasksCompleted)
712-
}
709+
// TODO(3977): register internal nodes for later verifications. The
710+
// following limits the possibility of some common and useful cycles.
711+
//
712+
// if arc.Internal() && c.isDevVersion() {
713+
// mode := state.conditions()
714+
// state = final(partial, mode|allTasksCompleted)
715+
// }
713716
orig := arc
714717
// TODO(deref): what is the right level of dereferencing here?
715718
// DerefValue seems to work too.

0 commit comments

Comments
 (0)