Skip to content

Commit 062b3d8

Browse files
committed
internal/core/eval: sort empty disjunction message to top of group
By adding leading with the number, which sorts before any letter. Change-Id: I8027f61e74e7ca206ec78dfdbbe7534d21ef1cc5 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8042 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 0ef6caa commit 062b3d8

File tree

13 files changed

+41
-40
lines changed

13 files changed

+41
-40
lines changed

cmd/cue/cmd/testdata/script/eval_errs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmp stdout expect-stdout
44

55
-- expect-stdout --
66
-- expect-stderr --
7-
bar: empty disjunction: 2 related errors:
7+
bar: 2 errors in empty disjunction:
88
bar.a: conflicting values "str" and int (mismatched types string and int):
99
./errs.cue:5:10
1010
./errs.cue:6:6

cue/testdata/benchmarks/dedupelem.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ foo: [{type: "float"}] & [...#Value]
1515
foo: [{type: "float"}] & [...#Value]
1616
-- out/eval --
1717
Errors:
18-
foo.0: empty disjunction: 2 related errors:
18+
foo.0: 2 errors in empty disjunction:
1919
foo.0.type: conflicting values "int" and "float":
2020
./in.cue:3:16
2121
./in.cue:5:14
@@ -37,7 +37,7 @@ Result:
3737
foo: (_|_){
3838
// [eval]
3939
0: (_|_){
40-
// [eval] foo.0: empty disjunction: 2 related errors:
40+
// [eval] foo.0: 2 errors in empty disjunction:
4141
// foo.0.type: conflicting values "int" and "float":
4242
// ./in.cue:3:16
4343
// ./in.cue:5:14

cue/testdata/cycle/issue429.txtar

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ er3: #nonEmptyRange & {
5252

5353
-- out/eval --
5454
Errors:
55-
er3.min: empty disjunction: 1 related errors:
56-
es3.max: empty disjunction: 1 related errors:
55+
er3.min: 1 errors in empty disjunction:
56+
es3.max: 1 errors in empty disjunction:
5757
es3.max: invalid value 5 (out of bound >10):
5858
./in.cue:5:10
5959
./in.cue:22:10
@@ -94,7 +94,7 @@ Result:
9494
res: (int){ |(*(int){ 0 }, (int){ &(>=0, int) }) }
9595
min: (int){ 10 }
9696
max: (_|_){
97-
// [eval] es3.max: empty disjunction: 1 related errors:
97+
// [eval] es3.max: 1 errors in empty disjunction:
9898
// es3.max: invalid value 5 (out of bound >10):
9999
// ./in.cue:5:10
100100
// ./in.cue:22:10
@@ -123,13 +123,13 @@ Result:
123123
er3: (_|_){
124124
// [eval]
125125
min: (_|_){
126-
// [eval] er3.min: empty disjunction: 1 related errors:
126+
// [eval] er3.min: 1 errors in empty disjunction:
127127
// er3.min: invalid value 5 (out of bound <5):
128128
// ./in.cue:29:10
129129
// ./in.cue:44:10
130130
}
131131
max: (_|_){
132-
// [eval] er3.min: empty disjunction: 1 related errors:
132+
// [eval] er3.min: 1 errors in empty disjunction:
133133
// er3.min: invalid value 5 (out of bound <5):
134134
// ./in.cue:29:10
135135
// ./in.cue:44:10

cue/testdata/cycle/structural.txtar

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,30 +440,30 @@ e3.b.c: conflicting values [b] and {c:b} (mismatched types list and struct):
440440
./in.cue:293:8
441441
./in.cue:293:11
442442
e3.b.c: structural cycle
443+
e4.a.0: 4 errors in empty disjunction:
443444
e4.a.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
444445
./in.cue:297:13
445446
./in.cue:298:9
446-
e4.a.0: empty disjunction: 4 related errors:
447+
e4.a.0.0: 2 errors in empty disjunction:
447448
e4.a.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct):
448449
./in.cue:298:9
449450
./in.cue:298:10
450451
e4.a.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
451452
./in.cue:297:9
452453
./in.cue:297:13
453454
./in.cue:298:9
454-
e4.a.0.0: empty disjunction: 2 related errors:
455+
e4.b.0: 4 errors in empty disjunction:
455456
e4.b.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
456457
./in.cue:300:9
457458
./in.cue:301:13
458-
e4.b.0: empty disjunction: 4 related errors:
459+
e4.b.0.0: 2 errors in empty disjunction:
459460
e4.b.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct):
460461
./in.cue:300:9
461462
./in.cue:300:10
462463
e4.b.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
463464
./in.cue:300:9
464465
./in.cue:301:9
465466
./in.cue:301:13
466-
e4.b.0.0: empty disjunction: 2 related errors:
467467
p2.#T.a.b.link: structural cycle
468468
p3.#U.#T.a.b.link: structural cycle
469469
p5.#T.a.0.link: structural cycle
@@ -1212,18 +1212,18 @@ Result:
12121212
a: (_|_){
12131213
// [eval]
12141214
0: (_|_){
1215-
// [eval] e4.a.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
1215+
// [eval] e4.a.0: 4 errors in empty disjunction:
1216+
// e4.a.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
12161217
// ./in.cue:297:13
12171218
// ./in.cue:298:9
1218-
// e4.a.0: empty disjunction: 4 related errors:
1219+
// e4.a.0.0: 2 errors in empty disjunction:
12191220
// e4.a.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct):
12201221
// ./in.cue:298:9
12211222
// ./in.cue:298:10
12221223
// e4.a.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
12231224
// ./in.cue:297:9
12241225
// ./in.cue:297:13
12251226
// ./in.cue:298:9
1226-
// e4.a.0.0: empty disjunction: 2 related errors:
12271227
0: (struct){
12281228
c: (int){ 1 }
12291229
}
@@ -1232,18 +1232,18 @@ Result:
12321232
b: (_|_){
12331233
// [eval]
12341234
0: (_|_){
1235-
// [eval] e4.b.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
1235+
// [eval] e4.b.0: 4 errors in empty disjunction:
1236+
// e4.b.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
12361237
// ./in.cue:300:9
12371238
// ./in.cue:301:13
1238-
// e4.b.0: empty disjunction: 4 related errors:
1239+
// e4.b.0.0: 2 errors in empty disjunction:
12391240
// e4.b.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct):
12401241
// ./in.cue:300:9
12411242
// ./in.cue:300:10
12421243
// e4.b.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct):
12431244
// ./in.cue:300:9
12441245
// ./in.cue:301:9
12451246
// ./in.cue:301:13
1246-
// e4.b.0.0: empty disjunction: 2 related errors:
12471247
0: (struct){
12481248
c: (int){ 1 }
12491249
}

cue/testdata/disjunctions/errors.txtar

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ explicitDefaultError: {
3434

3535
-- out/eval --
3636
Errors:
37-
issue516.x: empty disjunction: 2 related errors:
37+
issue516.x: 2 errors in empty disjunction:
3838
issue516.x: field `match` not allowed:
3939
./in.cue:20:9
4040
./in.cue:22:8
@@ -43,7 +43,7 @@ issue516.x.match.metrics: field `foo` not allowed:
4343
./in.cue:19:25
4444
./in.cue:22:8
4545
./in.cue:23:24
46-
issue570.results: empty disjunction: 2 related errors:
46+
issue570.results: 2 errors in empty disjunction:
4747
issue570.results: field `result` not allowed:
4848
./in.cue:2:14
4949
./in.cue:3:14
@@ -61,7 +61,7 @@ Result:
6161
issue570: (_|_){
6262
// [eval]
6363
results: (_|_){
64-
// [eval] issue570.results: empty disjunction: 2 related errors:
64+
// [eval] issue570.results: 2 errors in empty disjunction:
6565
// issue570.results: field `result` not allowed:
6666
// ./in.cue:2:14
6767
// ./in.cue:3:14
@@ -106,7 +106,7 @@ Result:
106106
}, (#struct){
107107
}) }
108108
x: (_|_){
109-
// [eval] issue516.x: empty disjunction: 2 related errors:
109+
// [eval] issue516.x: 2 errors in empty disjunction:
110110
// issue516.x: field `match` not allowed:
111111
// ./in.cue:20:9
112112
// ./in.cue:22:8

cue/testdata/eval/closed_disjunction.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ b: #A & {
1515
}
1616
-- out/eval --
1717
Errors:
18-
b: empty disjunction: 2 related errors:
18+
b: 2 errors in empty disjunction:
1919
b: field `c` not allowed:
2020
./in.cue:1:5
2121
./in.cue:3:5
@@ -39,7 +39,7 @@ Result:
3939
c: (int){ 3 }
4040
}
4141
b: (_|_){
42-
// [eval] b: empty disjunction: 2 related errors:
42+
// [eval] b: 2 errors in empty disjunction:
4343
// b: field `c` not allowed:
4444
// ./in.cue:1:5
4545
// ./in.cue:3:5

cue/testdata/eval/disjunctions.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ d100: {
6161

6262
-- out/eval --
6363
Errors:
64-
f: empty disjunction: 2 related errors:
64+
f: 2 errors in empty disjunction:
6565
f.name: conflicting values "int" and "str":
6666
./in.cue:5:8
6767
./in.cue:15:4
@@ -96,7 +96,7 @@ Result:
9696
name: (string){ "str" }
9797
}
9898
f: (_|_){
99-
// [eval] f: empty disjunction: 2 related errors:
99+
// [eval] f: 2 errors in empty disjunction:
100100
// f.name: conflicting values "int" and "str":
101101
// ./in.cue:5:8
102102
// ./in.cue:15:4

cue/testdata/fulleval/024_Issue_#23.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ y: _|_ // ; empty disjunction: conflicting values 2 and 3
2828
}
2929
-- out/eval --
3030
Errors:
31-
y: empty disjunction: 2 related errors:
31+
y: 2 errors in empty disjunction:
3232
y.a: conflicting values 1 and 3:
3333
./in.cue:1:12
3434
./in.cue:2:4
@@ -47,7 +47,7 @@ Result:
4747
a: (int){ 2 }
4848
}) }
4949
y: (_|_){
50-
// [eval] y: empty disjunction: 2 related errors:
50+
// [eval] y: 2 errors in empty disjunction:
5151
// y.a: conflicting values 1 and 3:
5252
// ./in.cue:1:12
5353
// ./in.cue:2:4

cue/testdata/resolve/029_non-closed_definition_carries_over_closedness_to_enclosed_template.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ a.v: field `b` not allowed:
108108
./in.cue:2:12
109109
./in.cue:4:4
110110
./in.cue:5:6
111-
b.w: empty disjunction: 1 related errors:
111+
b.w: 1 errors in empty disjunction:
112112
b.w: field `c` not allowed:
113113
./in.cue:8:12
114114
./in.cue:10:4
@@ -141,7 +141,7 @@ Result:
141141
b: (_|_){
142142
// [eval]
143143
w: (_|_){
144-
// [eval] b.w: empty disjunction: 1 related errors:
144+
// [eval] b.w: 1 errors in empty disjunction:
145145
// b.w: field `c` not allowed:
146146
// ./in.cue:8:12
147147
// ./in.cue:10:4

cue/testdata/resolve/030_definitions_with_disjunctions.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ baz: #Foo & {
6161
}
6262
-- out/eval --
6363
Errors:
64-
bar: empty disjunction: 1 related errors:
64+
bar: 1 errors in empty disjunction:
6565
bar: field `c` not allowed:
6666
./in.cue:1:7
6767
./in.cue:4:2
@@ -83,7 +83,7 @@ Result:
8383
a: (int){ 1 }
8484
}
8585
bar: (_|_){
86-
// [eval] bar: empty disjunction: 1 related errors:
86+
// [eval] bar: 1 errors in empty disjunction:
8787
// bar: field `c` not allowed:
8888
// ./in.cue:1:7
8989
// ./in.cue:4:2

0 commit comments

Comments
 (0)