You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
internal/core/adt: limit closedness check in Equal
The closedness check only makes sense
for CheckStructural . The flags != 0 test was
used before some of the other options were
introduced. We now only check closedness
if CheckStructural is enabled.
Note that this currently only impacts evalv2
behavior. The resulting changes are correct.
Issue #2583
Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I32a188f2d092469f043f6ae047cf914ffef90708
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1217007
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
Copy file name to clipboardExpand all lines: pkg/list/testdata/unique.txtar
+13-40Lines changed: 13 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -196,17 +196,16 @@ fail: {
196
196
diff old new
197
197
--- old
198
198
+++ new
199
-
@@ -2,6 +2,9 @@
199
+
@@ -2,7 +2,7 @@
200
200
fail.ignoreHidden: invalid value [1,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 1:
201
201
./in.cue:3:21
202
202
./in.cue:48:16
203
+
-fail.ignoreOptError: invalid value [{a:1},{a:1,b?:_|_(fail.ignoreOptError.1.b: conflicting values int and string (mismatched types int and string))}] (does not satisfy list.UniqueItems): equal values at position 0 and 1:
203
204
+fail.ignoreOptError: invalid value [~(#a),~(#abErr)] (does not satisfy list.UniqueItems): equal values at position 0 and 1:
204
-
+ ./in.cue:3:21
205
-
+ ./in.cue:52:18
206
-
fail.ints: invalid value [1,2,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 2:
207
205
./in.cue:3:21
208
-
./in.cue:44:8
209
-
@@ -8,7 +11,7 @@
206
+
./in.cue:52:18
207
+
fail.ints: invalid value [1,2,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 2:
208
+
@@ -11,7 +11,7 @@
210
209
fail.structOrderIrrelevant: invalid value [{b:1,a:0},{a:0,b:1}] (does not satisfy list.UniqueItems): equal values at position 0 and 1:
211
210
./in.cue:3:21
212
211
./in.cue:72:30
@@ -215,21 +214,7 @@ diff old new
215
214
./in.cue:3:21
216
215
./in.cue:45:11
217
216
218
-
@@ -67,12 +70,7 @@
219
-
}]
220
-
221
-
// Ditto. This time with actually closed fields.
222
-
- withOptional3: [{
223
-
- a: 1
224
-
- }, {
225
-
- a: 1
226
-
- b?: int
227
-
- }]
228
-
+ withOptional3: list.UniqueItems() & [#a, #ab]
229
-
230
-
// Ditto. There are not optional fields, but the structs are open.
231
-
openSpecific: list.UniqueItems() & [{
232
-
@@ -100,7 +98,7 @@
217
+
@@ -98,7 +98,7 @@
233
218
}
234
219
fail: {
235
220
ints: _|_ // fail.ints: invalid value [1,2,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 2
@@ -238,16 +223,11 @@ diff old new
238
223
239
224
// Hidden values do not play a role in the comparisson.
240
225
ignoreHidden: _|_ // fail.ignoreHidden: invalid value [1,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 1
241
-
@@ -107,12 +105,7 @@
226
+
@@ -105,7 +105,7 @@
242
227
243
228
// This can be a permanent error, as the optional field of the second
244
229
// element is erroneous an cannot match.
245
-
- ignoreOptError: [{
246
-
- a: 1
247
-
- }, {
248
-
- a: 1
249
-
- b?: int & string
250
-
- }]
230
+
- ignoreOptError: _|_ // fail.ignoreOptError: invalid value [{a:1},{a:1,b?:_|_(fail.ignoreOptError.1.b: conflicting values int and string (mismatched types int and string))}] (does not satisfy list.UniqueItems): equal values at position 0 and 1
251
231
+ ignoreOptError: _|_ // fail.ignoreOptError: invalid value [~(#a),~(#abErr)] (does not satisfy list.UniqueItems): equal values at position 0 and 1
252
232
253
233
// Struct field order is irrelevant. We simulate finalising
@@ -257,6 +237,9 @@ Errors:
257
237
fail.ignoreHidden: invalid value [1,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 1:
258
238
./in.cue:3:21
259
239
./in.cue:48:16
240
+
fail.ignoreOptError: invalid value [{a:1},{a:1,b?:_|_(fail.ignoreOptError.1.b: conflicting values int and string (mismatched types int and string))}] (does not satisfy list.UniqueItems): equal values at position 0 and 1:
241
+
./in.cue:3:21
242
+
./in.cue:52:18
260
243
fail.ints: invalid value [1,2,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 2:
261
244
./in.cue:3:21
262
245
./in.cue:44:8
@@ -322,12 +305,7 @@ incomplete: {
322
305
}]
323
306
324
307
// Ditto. This time with actually closed fields.
325
-
withOptional3: [{
326
-
a: 1
327
-
}, {
328
-
a: 1
329
-
b?: int
330
-
}]
308
+
withOptional3: list.UniqueItems() & [#a, #ab]
331
309
332
310
// Ditto. There are not optional fields, but the structs are open.
333
311
openSpecific: list.UniqueItems() & [{
@@ -362,12 +340,7 @@ fail: {
362
340
363
341
// This can be a permanent error, as the optional field of the second
364
342
// element is erroneous an cannot match.
365
-
ignoreOptError: [{
366
-
a: 1
367
-
}, {
368
-
a: 1
369
-
b?: int & string
370
-
}]
343
+
ignoreOptError: _|_ // fail.ignoreOptError: invalid value [{a:1},{a:1,b?:_|_(fail.ignoreOptError.1.b: conflicting values int and string (mismatched types int and string))}] (does not satisfy list.UniqueItems): equal values at position 0 and 1
371
344
372
345
// Struct field order is irrelevant. We simulate finalising
373
346
// these values here via close(), which gives the same behaviour
0 commit comments