@@ -222,16 +222,26 @@ inline: {
222
222
age2: 5 // not allowed
223
223
}
224
224
}
225
+ -- validation.cue --
226
+ import "list"
227
+
228
+ issue3332: {
229
+ #def: field: list.MinItems(1)
230
+ use: #def & {
231
+ field: ["value"]
232
+ }
233
+ }
234
+
225
235
-- out/eval/stats --
226
236
Leaks: 3
227
- Freed: 263
228
- Reused: 255
237
+ Freed: 269
238
+ Reused: 261
229
239
Allocs: 11
230
240
Retain: 29
231
241
232
- Unifications: 258
233
- Conjuncts: 472
234
- Disjuncts: 292
242
+ Unifications: 264
243
+ Conjuncts: 482
244
+ Disjuncts: 299
235
245
-- out/eval --
236
246
Errors:
237
247
a.q.e: field not allowed:
@@ -763,6 +773,16 @@ Result:
763
773
age2: (int){ 5 }
764
774
}
765
775
}
776
+ issue3332: (struct){
777
+ #def: (#struct){
778
+ field: (list){ list.MinItems(1) }
779
+ }
780
+ use: (#struct){
781
+ field: (#list){
782
+ 0: (string){ "value" }
783
+ }
784
+ }
785
+ }
766
786
}
767
787
-- out/evalalpha --
768
788
Errors:
@@ -790,6 +810,8 @@ inline.err1.age1: field not allowed:
790
810
inline.err2.age2: field not allowed:
791
811
./reroot.cue:147:8
792
812
./reroot.cue:149:3
813
+ issue3332.use.field.0: field not allowed:
814
+ ./validation.cue:6:11
793
815
794
816
Result:
795
817
(_|_){
@@ -1223,12 +1245,29 @@ Result:
1223
1245
}
1224
1246
}
1225
1247
}
1248
+ issue3332: (_|_){
1249
+ // [eval]
1250
+ #def: (#struct){
1251
+ field: (list){ list.MinItems(1) }
1252
+ }
1253
+ use: (_|_){
1254
+ // [eval]
1255
+ field: (_|_){
1256
+ // [eval] issue3332.use.field.0: field not allowed:
1257
+ // ./validation.cue:6:11
1258
+ 0: (_|_){
1259
+ // [eval] issue3332.use.field.0: field not allowed:
1260
+ // ./validation.cue:6:11
1261
+ }
1262
+ }
1263
+ }
1264
+ }
1226
1265
}
1227
1266
-- diff/-out/evalalpha<==>+out/eval --
1228
1267
diff old new
1229
1268
--- old
1230
1269
+++ new
1231
- @@ -1,66 +1,28 @@
1270
+ @@ -1,66 +1,30 @@
1232
1271
Errors:
1233
1272
+nested.err1.x.b.f: field not allowed:
1234
1273
+ ./reroot.cue:114:6
@@ -1308,10 +1347,12 @@ diff old new
1308
1347
+inline.err2.age2: field not allowed:
1309
1348
+ ./reroot.cue:147:8
1310
1349
+ ./reroot.cue:149:3
1350
+ +issue3332.use.field.0: field not allowed:
1351
+ + ./validation.cue:6:11
1311
1352
1312
1353
Result:
1313
1354
(_|_){
1314
- @@ -76,13 +38 ,13 @@
1355
+ @@ -76,13 +40 ,13 @@
1315
1356
}
1316
1357
}
1317
1358
#Extended: (#struct){
@@ -1332,7 +1373,7 @@ diff old new
1332
1373
}
1333
1374
broken: (#struct){
1334
1375
name: (string){ "base" }
1335
- @@ -94,13 +56 ,13 @@
1376
+ @@ -94,13 +58 ,13 @@
1336
1377
}
1337
1378
}
1338
1379
works: (#struct){
@@ -1353,7 +1394,7 @@ diff old new
1353
1394
}
1354
1395
}
1355
1396
}
1356
- @@ -110,8 +72 ,8 @@
1397
+ @@ -110,8 +74 ,8 @@
1357
1398
#A: (#struct){
1358
1399
b: (int){ int }
1359
1400
q: (#struct){
@@ -1363,7 +1404,7 @@ diff old new
1363
1404
}
1364
1405
}
1365
1406
a: (_|_){
1366
- @@ -120,21 +82 ,17 @@
1407
+ @@ -120,21 +84 ,17 @@
1367
1408
q: (_|_){
1368
1409
// [eval]
1369
1410
c: (int){ 2 }
@@ -1387,7 +1428,7 @@ diff old new
1387
1428
// ./in.cue:28:5
1388
1429
#A: (#struct){
1389
1430
}
1390
- @@ -142,8 +100 ,7 @@
1431
+ @@ -142,8 +102 ,7 @@
1391
1432
// [eval]
1392
1433
Foo: (_|_){
1393
1434
// [eval] issue852.a.Foo: field not allowed:
@@ -1397,7 +1438,7 @@ diff old new
1397
1438
// ./in.cue:28:5
1398
1439
}
1399
1440
}
1400
- @@ -154,8 +111 ,8 @@
1441
+ @@ -154,8 +113 ,8 @@
1401
1442
foo: (int){ int }
1402
1443
}
1403
1444
d: (#struct){
@@ -1407,7 +1448,7 @@ diff old new
1407
1448
}
1408
1449
}
1409
1450
issue3330: (struct){
1410
- @@ -211,11 +168 ,11 @@
1451
+ @@ -211,11 +170 ,11 @@
1411
1452
g: (#struct){
1412
1453
}
1413
1454
}
@@ -1424,7 +1465,7 @@ diff old new
1424
1465
}
1425
1466
}
1426
1467
}
1427
- @@ -261,8 +218 ,7 @@
1468
+ @@ -261,8 +220 ,7 @@
1428
1469
}
1429
1470
}
1430
1471
}
@@ -1434,7 +1475,7 @@ diff old new
1434
1475
embed: (struct){
1435
1476
err1: (struct){
1436
1477
#A: (#struct){
1437
- @@ -299,17 +255 ,15 @@
1478
+ @@ -299,17 +257 ,15 @@
1438
1479
c: (int){ 2 }
1439
1480
}
1440
1481
}
@@ -1459,7 +1500,7 @@ diff old new
1459
1500
X: (struct){
1460
1501
a: (struct){
1461
1502
e: (int){ 1 }
1462
- @@ -317,24 +271 ,13 @@
1503
+ @@ -317,24 +273 ,13 @@
1463
1504
b: (struct){
1464
1505
}
1465
1506
}
@@ -1491,7 +1532,7 @@ diff old new
1491
1532
}
1492
1533
}
1493
1534
#X: (#struct){
1494
- @@ -397,17 +340 ,11 @@
1535
+ @@ -397,17 +342 ,11 @@
1495
1536
// [eval]
1496
1537
f: (_|_){
1497
1538
// [eval] nested.err1.x.b.f: field not allowed:
@@ -1511,7 +1552,7 @@ diff old new
1511
1552
}
1512
1553
}
1513
1554
v: (_|_){
1514
- @@ -414,27 +351 ,17 @@
1555
+ @@ -414,27 +353 ,17 @@
1515
1556
// [eval]
1516
1557
c: (_|_){
1517
1558
// [eval]
@@ -1550,7 +1591,7 @@ diff old new
1550
1591
}
1551
1592
}
1552
1593
#V: (_|_){
1553
- @@ -441,25 +368 ,17 @@
1594
+ @@ -441,25 +370 ,17 @@
1554
1595
// [eval]
1555
1596
c: (_|_){
1556
1597
// [eval]
@@ -1587,7 +1628,7 @@ diff old new
1587
1628
}
1588
1629
}
1589
1630
}
1590
- @@ -469,14 +388 ,14 @@
1631
+ @@ -469,14 +390 ,14 @@
1591
1632
}
1592
1633
v: (#struct){
1593
1634
c: (#struct){
@@ -1606,7 +1647,7 @@ diff old new
1606
1647
}
1607
1648
}
1608
1649
}
1609
- @@ -499,19 +418 ,18 @@
1650
+ @@ -499,19 +420 ,18 @@
1610
1651
// [eval]
1611
1652
g: (_|_){
1612
1653
// [eval] nested.err2.x.b.g: field not allowed:
@@ -1633,7 +1674,7 @@ diff old new
1633
1674
#x: (#struct){
1634
1675
y: (#struct){
1635
1676
z?: (#struct){
1636
- @@ -519,13 +437,23 @@
1677
+ @@ -519,22 +439,39 @@
1637
1678
}
1638
1679
}
1639
1680
}
@@ -1644,6 +1685,9 @@ diff old new
1644
1685
- err2: (struct){
1645
1686
- name: (string){ "a" }
1646
1687
- age2: (int){ 5 }
1688
+ - }
1689
+ - }
1690
+ - issue3332: (struct){
1647
1691
+ err1: (_|_){
1648
1692
+ // [eval]
1649
1693
+ name: (string){ "a" }
@@ -1661,9 +1705,28 @@ diff old new
1661
1705
+ // ./reroot.cue:147:8
1662
1706
+ // ./reroot.cue:149:3
1663
1707
+ }
1708
+ + }
1709
+ + }
1710
+ + issue3332: (_|_){
1711
+ + // [eval]
1712
+ #def: (#struct){
1713
+ field: (list){ list.MinItems(1) }
1714
+ }
1715
+ - use: (#struct){
1716
+ - field: (#list){
1717
+ - 0: (string){ "value" }
1718
+ + use: (_|_){
1719
+ + // [eval]
1720
+ + field: (_|_){
1721
+ + // [eval] issue3332.use.field.0: field not allowed:
1722
+ + // ./validation.cue:6:11
1723
+ + 0: (_|_){
1724
+ + // [eval] issue3332.use.field.0: field not allowed:
1725
+ + // ./validation.cue:6:11
1726
+ + }
1727
+ }
1664
1728
}
1665
1729
}
1666
- }
1667
1730
-- diff/todo/p2 --
1668
1731
Positions / reordering
1669
1732
@@ -1963,3 +2026,16 @@ inline.err*.age*: fields are now correctly not allowed.
1963
2026
})
1964
2027
}
1965
2028
}
2029
+ --- validation.cue
2030
+ {
2031
+ issue3332: {
2032
+ #def: {
2033
+ field: 〈import;list〉.MinItems(1)
2034
+ }
2035
+ use: (〈0;#def〉 & {
2036
+ field: [
2037
+ "value",
2038
+ ]
2039
+ })
2040
+ }
2041
+ }
0 commit comments