cuelang.org/go@v0.13.0/cue/testdata/builtins/matchn.txtar (about) 1 -- in.cue -- 2 import "math" 3 4 #Foo: { 5 a: int 6 } 7 8 match: { 9 [=~"^single"]: matchN(1, [#Foo]) 10 singleOK: a: 2 11 singleErr: a: "foo" 12 13 [=~"^incomplete"]: matchN(1, [#Foo]) 14 incompleteOK: a: int 15 incompleteErr: a: string 16 17 #A: { 18 a: int 19 b: _ 20 ... 21 } 22 23 defaults: { 24 // Because validators distribute over disjunctions, this validator may erase 25 // a default value. Nonethenless, it will be guaranteed that the value 26 // resulting from evaluation does not violate the validator. 27 // TODO(defaults): take this use case into consideration for the defaults 28 // rethink, as it seems less than ideal. Note that this typically not an 29 // issue if the schema matched against is not concrete. 30 [=~"^pickTop"]: matchN(1, [2]) 31 pickTopOK1: *2 | int 32 pickTopOK2: int 33 pickTopErr: *3 | int // Final values taken. 34 35 // Nested default values will be evaluated and may not be overridden by 36 // values in the validator. 37 [=~"^pickNested1"]: matchN(1, [{a: 2}]) 38 pickNested1OK1: a: *2 | int 39 pickNested1OK2: a: int 40 pickNested1Err: a: *3 | int 41 42 [=~"^pickNested2"]: matchN(1, [{a: <=2}]) 43 pickNested2OK1: a: *2 | int 44 pickNested2OK2: a: int 45 pickNested2Err: a: *3 | int 46 } 47 48 // Stress test potential exponential behavior. 49 nestedOK: { 50 matchN(4, [#A, #A, #A, #A]) 51 52 a: 2 53 b: { 54 matchN(4, [#A, #A, #A, #A]) 55 56 a: 3 57 b: matchN(4, [#A, #A, #A, #A]) 58 b: a: 4 59 c: matchN(4, [#A, #A, #A, #A]) 60 c: a: 5 61 } 62 c: { 63 matchN(4, [#A, #A, #A, #A]) 64 65 a: 3 66 b: matchN(4, [#A, #A, #A, #A]) 67 b: a: 4 68 c: matchN(4, [#A, #A, #A, #A]) 69 c: a: 5 70 } 71 } 72 } 73 74 not: { 75 [=~"^single"]: matchN(0, [#Foo]) 76 singleOK: a: "foo" 77 singleErr: a: 2 78 79 [=~"^double"]: matchN(0, [matchN(0, [#Foo])]) 80 doubleOK: a: 2 81 doubleErr: a: "foo" 82 } 83 84 oneOf: { 85 [=~"^multiple1"]: matchN(1, [math.MultipleOf(3), math.MultipleOf(5)]) 86 87 multiple1Err1: 1 88 89 multiple1OK1: 3 90 multiple1OK2: 5 91 92 multiple1Err2: 15 93 } 94 95 anyOf: { 96 [=~"^multiple1"]: matchN(>0, [math.MultipleOf(3), math.MultipleOf(5)]) 97 98 multiple1Err1: 1 99 100 multiple1OK1: 3 101 multiple1OK2: 5 102 multiple1OK3: 15 103 } 104 105 106 allOf: { 107 [=~"^multiple1"]: matchN(2, [math.MultipleOf(3), math.MultipleOf(5)]) 108 109 multiple1Err1: 1 110 multiple1Err2: 3 111 multiple1Err3: 5 112 113 multiple1OK1: 15 114 } 115 116 bare: { 117 embed: t1: { 118 a: {matchN(1, [>10])} 119 b: {a} 120 } 121 embed: t2: { 122 b: {a} 123 a: {matchN(1, [>10])} 124 } 125 direct: t1: { 126 a: matchN(1, [>10]) 127 b: a 128 } 129 direct: t2: { 130 b: a 131 a: matchN(1, [>10]) 132 } 133 } 134 135 required: { 136 ok1: { 137 x: matchN(0, [{foo!: string}]) 138 x: bar: 2 139 } 140 ok2: { 141 x: matchN(0, [{foo!: string}]) 142 } 143 // not matching for different reasons 144 ok3: { 145 x: matchN(0, [{bar!: string}]) 146 x: bar: 2 147 } 148 } 149 150 // A struct with extra fields should match whether or not inside a list. 151 // evalv2 would get this wrong but evalv3 got it right. 152 issue3575: { 153 test1: { 154 #x: matchN(1, [ 155 [{}], 156 ]) 157 x: #x 158 x: [{a: 1}] 159 } 160 test2: { 161 #x: matchN(1, [ 162 {}, 163 ]) 164 x: #x 165 x: {a: 1} 166 } 167 } 168 169 -- incomplete.cue -- 170 import "math" 171 172 // The errors in this section should be "incomplete" errors. 173 incomplete: { 174 // foo could still be provided later. 175 incomplete1: { 176 x: matchN(1, [{foo!: string}]) 177 x: bar: 2 178 } 179 // foo could still be provided later. 180 incomplete2: { 181 x: matchN(1, [{foo!: string}]) 182 } 183 // in case of doubt, we should mark an error as incomplete to be safe. 184 incomplete3: { 185 x: matchN(math.MultipleOf(2), [{bar!: int}, {foo!: int}]) 186 x: bar: 2 187 } 188 incomplete4: { 189 x: matchN(math.MultipleOf(2), [{bar!: int}, {foo!: int}, {baz!: int}]) 190 x: bar: 2 191 } 192 incomplete5: { 193 x: matchN(>1 & <=3, [{bar!: int}, {foo!: int}, {baz!: int}]) 194 x: bar: 2 195 } 196 incomplete6: { 197 x: matchN(2|3, [{bar!: int}, {foo!: int}, {baz!: int}]) 198 x: bar: 2 199 } 200 201 // incorrect type cannot be corrected 202 err1: { 203 x: matchN(1, [{bar!: string}]) 204 x: bar: 2 205 } 206 // additional incomplete matches should not be counted if they can otherwise 207 // not satisfy the constraint. 208 err2: { 209 x: matchN(0, [{bar!: int}, {foo!: int}]) 210 x: bar: 2 211 } 212 // additional incomplete matches should not be counted if they can otherwise 213 // not satisfy the constraint. 214 err3: { 215 x: matchN(2, [{bar!: string}, {foo!: string}]) 216 x: bar: 2 217 } 218 // one additional potential match cannot make up to satisfy the bound. 219 err4: { 220 x: matchN(>1, [{bar!: string}, {foo!: string}]) 221 x: bar: 2 222 } 223 err5: { 224 x: matchN(<1, [{bar!: int}, {foo!: int}]) 225 x: bar: 2 226 } 227 } 228 issue3389: { 229 // only report schema errors that are of a lesser severity. 230 x: bar: 2 231 x: matchN(1, [{bar: 3}, {bar: 2, foo!: int}]) 232 } 233 -- closedness.cue -- 234 ellipsis: ok: { 235 out: #Schema & { 236 field: shouldBeAllowed: 123 237 } 238 #Schema: { 239 field?: #anything 240 #anything: matchN(1, [{ ... }]) 241 } 242 } 243 // Arguments to function are not closed by enclosing definition. 244 openArguments: ok1: { 245 #Schema: {{ 246 a: matchN(1, ["all", {foo: "bar"}]) 247 }} 248 out: #Schema & { 249 a: baz: "allowed" 250 } 251 } 252 openArguments: err2: { 253 #Schema: {{ 254 a?: matchN(1, [ //fails 255 null, // fail 256 { [string]: string }, // pass 257 {b: {...}}, // pass 258 ]) 259 }} 260 out: #Schema & { 261 a: allowed: "once" 262 } 263 } 264 explicitClose: err1: { 265 #Schema: {{ 266 a: matchN(1, ["all", close({foo: "bar"})]) 267 }} 268 out: #Schema & { 269 a: baz: "notAllowed" 270 } 271 } 272 explicitClose: ok2: { 273 #Schema: {{ 274 a?: matchN(1, [ 275 null, // fail 276 close({ [string]: string }), // pass 277 close({b: {...}}), // fail 278 ]) 279 }} 280 out: #Schema & { 281 a: allowed: "once" 282 } 283 } 284 mixed: ok3: { 285 #Schema: { 286 exports?: matchN(1, [ 287 close({ never?: _ }), // fail 288 #exportsObject, // pass 289 ]) 290 291 #exports: matchN(1, [string, #exportsObject]) 292 #exportsObject: exp1?: #exports 293 } 294 295 out: #Schema & { 296 exports: exp1: "./main-module.js" 297 } 298 } 299 300 closedByDefinition: ok4: { 301 #Schema: { 302 exports?: matchN(1, [string, #exportsObject]) 303 #exports: matchN(1, [string, #exportsObject]) 304 #exportsObject: exp1?: #exports 305 } 306 307 out: #Schema & { 308 exports: exp1: "./main-module.js" 309 } 310 } 311 closedByDefinition: err5: { 312 #Schema: { 313 exports?: matchN(1, [null, #exportsObject]) 314 #exports: matchN(1, [null, #exportsObject]) 315 #exportsObject: exp1?: #exports 316 } 317 318 out: #Schema & { 319 exports: exp1: "./main-module.js" 320 } 321 } 322 -- issue3694.cue -- 323 issue3694: full: { 324 #step: matchN(1, [{ 325 uses!: _ 326 ... 327 }, { 328 run!: _ 329 ... 330 }]) 331 #step: close({ 332 uses?: string 333 run?: string 334 }) 335 336 s: #step & { 337 run: "echo hello world" 338 } 339 } 340 issue3694: simple: { 341 #step: matchN(1, [{ 342 uses!: _ 343 }]) 344 #step: close({ 345 uses?: string 346 }) 347 } 348 -- out/eval/stats -- 349 Leaks: 52 350 Freed: 951 351 Reused: 944 352 Allocs: 59 353 Retain: 129 354 355 Unifications: 987 356 Conjuncts: 1635 357 Disjuncts: 1081 358 -- out/eval -- 359 Errors: 360 closedByDefinition.err5.out.exports: conflicting values null and {exp1:"./main-module.js"} (mismatched types null and struct): 361 ./closedness.cue:80:13 362 ./closedness.cue:80:24 363 ./closedness.cue:85:7 364 ./closedness.cue:86:12 365 closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and null (mismatched types string and null): 366 ./closedness.cue:80:30 367 ./closedness.cue:81:24 368 ./closedness.cue:82:26 369 ./closedness.cue:85:7 370 ./closedness.cue:86:18 371 closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and {exp1?:#exports} (mismatched types string and struct): 372 ./closedness.cue:80:30 373 ./closedness.cue:81:30 374 ./closedness.cue:82:19 375 ./closedness.cue:82:26 376 ./closedness.cue:85:7 377 ./closedness.cue:86:18 378 explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 379 ./closedness.cue:32:12 380 ./closedness.cue:33:6 381 ./closedness.cue:33:17 382 ./closedness.cue:35:7 383 ./closedness.cue:36:6 384 incomplete.err1.x.bar: conflicting values 2 and string (mismatched types int and string): 385 ./incomplete.cue:34:24 386 ./incomplete.cue:35:11 387 incomplete.err3.x.bar: conflicting values 2 and string (mismatched types int and string): 388 ./incomplete.cue:46:24 389 ./incomplete.cue:47:11 390 incomplete.err4.x.bar: conflicting values 2 and string (mismatched types int and string): 391 ./incomplete.cue:51:25 392 ./incomplete.cue:52:11 393 match.defaults.pickNested1Err.a: conflicting values 2 and 3: 394 ./in.cue:36:23 395 ./in.cue:36:38 396 ./in.cue:39:23 397 match.incompleteErr.a: conflicting values string and int (mismatched types string and int): 398 ./in.cue:4:5 399 ./in.cue:12:21 400 ./in.cue:12:32 401 ./in.cue:14:20 402 match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): 403 ./in.cue:4:5 404 ./in.cue:8:17 405 ./in.cue:8:28 406 ./in.cue:10:16 407 openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 408 ./closedness.cue:20:12 409 ./closedness.cue:21:13 410 ./closedness.cue:22:5 411 ./closedness.cue:27:7 412 ./closedness.cue:28:6 413 openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 414 ./closedness.cue:21:13 415 ./closedness.cue:21:20 416 ./closedness.cue:28:6 417 explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 418 ./closedness.cue:33:6 419 ./closedness.cue:33:13 420 ./closedness.cue:36:6 421 explicitClose.err1.out.a.baz: field not allowed: 422 ./closedness.cue:33:6 423 ./closedness.cue:32:12 424 ./closedness.cue:33:24 425 ./closedness.cue:33:30 426 ./closedness.cue:35:7 427 ./closedness.cue:36:11 428 closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 429 ./closedness.cue:80:13 430 ./closedness.cue:80:20 431 ./closedness.cue:86:12 432 closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 433 ./closedness.cue:81:13 434 ./closedness.cue:81:20 435 ./closedness.cue:82:26 436 ./closedness.cue:86:18 437 match.singleErr: invalid value {a:"foo"} (does not satisfy matchN): 0 matched, expected 1: 438 ./in.cue:8:17 439 ./in.cue:8:24 440 ./in.cue:10:13 441 match.incompleteErr: invalid value {a:string} (does not satisfy matchN): 0 matched, expected 1: 442 ./in.cue:12:21 443 ./in.cue:12:28 444 ./in.cue:14:17 445 match.defaults.pickNested1Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 446 ./in.cue:36:23 447 ./in.cue:36:30 448 ./in.cue:39:19 449 match.defaults.pickNested2Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 450 ./in.cue:41:23 451 ./in.cue:41:30 452 ./in.cue:44:19 453 match.defaults.pickNested2Err.a: invalid value 3 (out of bound <=2): 454 ./in.cue:41:38 455 ./in.cue:44:23 456 not.singleErr: invalid value {a:2} (does not satisfy matchN): 1 matched, expected 0: 457 ./in.cue:74:17 458 ./in.cue:74:24 459 ./in.cue:76:13 460 not.doubleErr: invalid value {a:"foo"} (does not satisfy matchN): 1 matched, expected 0: 461 ./in.cue:78:17 462 ./in.cue:78:24 463 ./in.cue:80:13 464 oneOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 1: 465 ./in.cue:84:20 466 ./in.cue:84:27 467 ./in.cue:86:17 468 oneOf.multiple1Err2: invalid value 15 (does not satisfy matchN): 2 matched, expected 1: 469 ./in.cue:84:20 470 ./in.cue:84:27 471 ./in.cue:91:17 472 oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 473 ./in.cue:84:31 474 ./in.cue:84:20 475 ./in.cue:84:47 476 ./in.cue:86:17 477 oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 478 ./in.cue:84:51 479 ./in.cue:84:20 480 ./in.cue:84:67 481 ./in.cue:86:17 482 anyOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected >0: 483 ./in.cue:95:20 484 ./in.cue:95:27 485 ./in.cue:97:17 486 anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 487 ./in.cue:95:32 488 ./in.cue:95:20 489 ./in.cue:95:48 490 ./in.cue:97:17 491 anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 492 ./in.cue:95:52 493 ./in.cue:95:20 494 ./in.cue:95:68 495 ./in.cue:97:17 496 allOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 2: 497 ./in.cue:106:20 498 ./in.cue:106:27 499 ./in.cue:108:17 500 allOf.multiple1Err2: invalid value 3 (does not satisfy matchN): 1 matched, expected 2: 501 ./in.cue:106:20 502 ./in.cue:106:27 503 ./in.cue:109:17 504 allOf.multiple1Err3: invalid value 5 (does not satisfy matchN): 1 matched, expected 2: 505 ./in.cue:106:20 506 ./in.cue:106:27 507 ./in.cue:110:17 508 allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 509 ./in.cue:106:31 510 ./in.cue:106:20 511 ./in.cue:106:47 512 ./in.cue:108:17 513 allOf.multiple1Err3: invalid value 5 (does not satisfy math.MultipleOf(3)): 514 ./in.cue:106:31 515 ./in.cue:106:20 516 ./in.cue:106:47 517 ./in.cue:110:17 518 allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 519 ./in.cue:106:51 520 ./in.cue:106:20 521 ./in.cue:106:67 522 ./in.cue:108:17 523 allOf.multiple1Err2: invalid value 3 (does not satisfy math.MultipleOf(5)): 524 ./in.cue:106:51 525 ./in.cue:106:20 526 ./in.cue:106:67 527 ./in.cue:109:17 528 issue3575.test1.x: invalid value [{a:1}] (does not satisfy matchN): 0 matched, expected 1: 529 ./in.cue:153:7 530 ./in.cue:153:14 531 ./in.cue:156:6 532 ./in.cue:157:6 533 issue3575.test1.x.0.a: field not allowed: 534 ./in.cue:153:7 535 ./in.cue:154:4 536 ./in.cue:154:5 537 ./in.cue:156:6 538 ./in.cue:157:8 539 incomplete.err1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 540 ./incomplete.cue:34:6 541 ./incomplete.cue:34:13 542 ./incomplete.cue:35:6 543 incomplete.err2.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected 0: 544 ./incomplete.cue:40:6 545 ./incomplete.cue:40:13 546 ./incomplete.cue:41:6 547 incomplete.err3.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 2: 548 ./incomplete.cue:46:6 549 ./incomplete.cue:46:13 550 ./incomplete.cue:47:6 551 incomplete.err4.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected >1: 552 ./incomplete.cue:51:6 553 ./incomplete.cue:51:13 554 ./incomplete.cue:52:6 555 incomplete.err5.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected <1: 556 ./incomplete.cue:55:6 557 ./incomplete.cue:55:13 558 ./incomplete.cue:56:6 559 560 Result: 561 (_|_){ 562 // [eval] 563 ellipsis: (struct){ 564 ok: (struct){ 565 out: (#struct){ 566 field: (struct){ 567 shouldBeAllowed: (int){ 123 } 568 } 569 #anything: (_){ matchN(1, (#list){ 570 0: (_|_){// { 571 // ... 572 // } 573 } 574 }) } 575 } 576 #Schema: (#struct){ 577 field?: (_){ matchN(1, (#list){ 578 0: (_|_){// { 579 // ... 580 // } 581 } 582 }) } 583 #anything: (_){ matchN(1, (#list){ 584 0: (_|_){// { 585 // ... 586 // } 587 } 588 }) } 589 } 590 } 591 } 592 openArguments: (_|_){ 593 // [eval] 594 ok1: (struct){ 595 #Schema: (#struct){ 596 a: (_){ matchN(1, (#list){ 597 0: (_|_){// "all" 598 } 599 1: (_|_){// { 600 // foo: "bar" 601 // } 602 } 603 }) } 604 } 605 out: (#struct){ 606 a: (struct){ 607 baz: (string){ "allowed" } 608 } 609 } 610 } 611 err2: (_|_){ 612 // [eval] 613 #Schema: (#struct){ 614 a?: (_){ matchN(1, (#list){ 615 0: (_|_){// null 616 } 617 1: (_|_){// { 618 // [string]: string 619 // } 620 } 621 2: (_|_){// { 622 // b: { 623 // ... 624 // } 625 // } 626 } 627 }) } 628 } 629 out: (_|_){ 630 // [eval] 631 a: (_|_){ 632 // [eval] openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 633 // ./closedness.cue:20:12 634 // ./closedness.cue:21:13 635 // ./closedness.cue:22:5 636 // ./closedness.cue:27:7 637 // ./closedness.cue:28:6 638 // openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 639 // ./closedness.cue:21:13 640 // ./closedness.cue:21:20 641 // ./closedness.cue:28:6 642 allowed: (string){ "once" } 643 } 644 } 645 } 646 } 647 explicitClose: (_|_){ 648 // [eval] 649 err1: (_|_){ 650 // [eval] 651 #Schema: (#struct){ 652 a: (_){ matchN(1, (#list){ 653 0: (_|_){// "all" 654 } 655 1: (_|_){// close({ 656 // foo: "bar" 657 // }) 658 } 659 }) } 660 } 661 out: (_|_){ 662 // [eval] 663 a: (_|_){ 664 // [eval] explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 665 // ./closedness.cue:32:12 666 // ./closedness.cue:33:6 667 // ./closedness.cue:33:17 668 // ./closedness.cue:35:7 669 // ./closedness.cue:36:6 670 // explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 671 // ./closedness.cue:33:6 672 // ./closedness.cue:33:13 673 // ./closedness.cue:36:6 674 // explicitClose.err1.out.a.baz: field not allowed: 675 // ./closedness.cue:33:6 676 // ./closedness.cue:32:12 677 // ./closedness.cue:33:24 678 // ./closedness.cue:33:30 679 // ./closedness.cue:35:7 680 // ./closedness.cue:36:11 681 baz: (string){ "notAllowed" } 682 } 683 } 684 } 685 ok2: (struct){ 686 #Schema: (#struct){ 687 a?: (_){ matchN(1, (#list){ 688 0: (_|_){// null 689 } 690 1: (_|_){// close({ 691 // [string]: string 692 // }) 693 } 694 2: (_|_){// close({ 695 // b: { 696 // ... 697 // } 698 // }) 699 } 700 }) } 701 } 702 out: (#struct){ 703 a: (struct){ 704 allowed: (string){ "once" } 705 } 706 } 707 } 708 } 709 mixed: (struct){ 710 ok3: (struct){ 711 #Schema: (#struct){ 712 exports?: (_){ matchN(1, (#list){ 713 0: (_|_){// close({ 714 // never?: _ 715 // }) 716 } 717 1: (_|_){// 〈1;#exportsObject〉 718 } 719 }) } 720 #exports: (_){ matchN(1, (#list){ 721 0: (_|_){// string 722 } 723 1: (_|_){// 〈1;#exportsObject〉 724 } 725 }) } 726 #exportsObject: (#struct){ 727 exp1?: (_){ matchN(1, (#list){ 728 0: (_|_){// string 729 } 730 1: (_|_){// 〈1;#exportsObject〉 731 } 732 }) } 733 } 734 } 735 out: (#struct){ 736 exports: (struct){ 737 exp1: (string){ "./main-module.js" } 738 } 739 #exports: (_){ matchN(1, (#list){ 740 0: (_|_){// string 741 } 742 1: (_|_){// 〈1;#exportsObject〉 743 } 744 }) } 745 #exportsObject: (#struct){ 746 exp1?: (_){ matchN(1, (#list){ 747 0: (_|_){// string 748 } 749 1: (_|_){// 〈1;#exportsObject〉 750 } 751 }) } 752 } 753 } 754 } 755 } 756 closedByDefinition: (_|_){ 757 // [eval] 758 ok4: (struct){ 759 #Schema: (#struct){ 760 exports?: (_){ matchN(1, (#list){ 761 0: (_|_){// string 762 } 763 1: (_|_){// 〈1;#exportsObject〉 764 } 765 }) } 766 #exports: (_){ matchN(1, (#list){ 767 0: (_|_){// string 768 } 769 1: (_|_){// 〈1;#exportsObject〉 770 } 771 }) } 772 #exportsObject: (#struct){ 773 exp1?: (_){ matchN(1, (#list){ 774 0: (_|_){// string 775 } 776 1: (_|_){// 〈1;#exportsObject〉 777 } 778 }) } 779 } 780 } 781 out: (#struct){ 782 exports: (struct){ 783 exp1: (string){ "./main-module.js" } 784 } 785 #exports: (_){ matchN(1, (#list){ 786 0: (_|_){// string 787 } 788 1: (_|_){// 〈1;#exportsObject〉 789 } 790 }) } 791 #exportsObject: (#struct){ 792 exp1?: (_){ matchN(1, (#list){ 793 0: (_|_){// string 794 } 795 1: (_|_){// 〈1;#exportsObject〉 796 } 797 }) } 798 } 799 } 800 } 801 err5: (_|_){ 802 // [eval] 803 #Schema: (#struct){ 804 exports?: (_){ matchN(1, (#list){ 805 0: (_|_){// null 806 } 807 1: (_|_){// 〈1;#exportsObject〉 808 } 809 }) } 810 #exports: (_){ matchN(1, (#list){ 811 0: (_|_){// null 812 } 813 1: (_|_){// 〈1;#exportsObject〉 814 } 815 }) } 816 #exportsObject: (#struct){ 817 exp1?: (_){ matchN(1, (#list){ 818 0: (_|_){// null 819 } 820 1: (_|_){// 〈1;#exportsObject〉 821 } 822 }) } 823 } 824 } 825 out: (_|_){ 826 // [eval] 827 exports: (_|_){ 828 // [eval] closedByDefinition.err5.out.exports: conflicting values null and {exp1:"./main-module.js"} (mismatched types null and struct): 829 // ./closedness.cue:80:13 830 // ./closedness.cue:80:24 831 // ./closedness.cue:85:7 832 // ./closedness.cue:86:12 833 // closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and null (mismatched types string and null): 834 // ./closedness.cue:80:30 835 // ./closedness.cue:81:24 836 // ./closedness.cue:82:26 837 // ./closedness.cue:85:7 838 // ./closedness.cue:86:18 839 // closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and {exp1?:#exports} (mismatched types string and struct): 840 // ./closedness.cue:80:30 841 // ./closedness.cue:81:30 842 // ./closedness.cue:82:19 843 // ./closedness.cue:82:26 844 // ./closedness.cue:85:7 845 // ./closedness.cue:86:18 846 // closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 847 // ./closedness.cue:80:13 848 // ./closedness.cue:80:20 849 // ./closedness.cue:86:12 850 // closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 851 // ./closedness.cue:81:13 852 // ./closedness.cue:81:20 853 // ./closedness.cue:82:26 854 // ./closedness.cue:86:18 855 exp1: (string){ "./main-module.js" } 856 } 857 #exports: (_){ matchN(1, (#list){ 858 0: (_|_){// null 859 } 860 1: (_|_){// 〈1;#exportsObject〉 861 } 862 }) } 863 #exportsObject: (#struct){ 864 exp1?: (_){ matchN(1, (#list){ 865 0: (_|_){// null 866 } 867 1: (_|_){// 〈1;#exportsObject〉 868 } 869 }) } 870 } 871 } 872 } 873 } 874 #Foo: (#struct){ 875 a: (int){ int } 876 } 877 match: (_|_){ 878 // [eval] 879 singleOK: (struct){ 880 a: (int){ 2 } 881 } 882 singleErr: (_|_){ 883 // [eval] match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): 884 // ./in.cue:4:5 885 // ./in.cue:8:17 886 // ./in.cue:8:28 887 // ./in.cue:10:16 888 // match.singleErr: invalid value {a:"foo"} (does not satisfy matchN): 0 matched, expected 1: 889 // ./in.cue:8:17 890 // ./in.cue:8:24 891 // ./in.cue:10:13 892 a: (string){ "foo" } 893 } 894 incompleteOK: (struct){ 895 a: (int){ int } 896 } 897 incompleteErr: (_|_){ 898 // [eval] match.incompleteErr.a: conflicting values string and int (mismatched types string and int): 899 // ./in.cue:4:5 900 // ./in.cue:12:21 901 // ./in.cue:12:32 902 // ./in.cue:14:20 903 // match.incompleteErr: invalid value {a:string} (does not satisfy matchN): 0 matched, expected 1: 904 // ./in.cue:12:21 905 // ./in.cue:12:28 906 // ./in.cue:14:17 907 a: (string){ string } 908 } 909 #A: (#struct){ 910 a: (int){ int } 911 b: (_){ _ } 912 } 913 defaults: (_|_){ 914 // [eval] 915 pickTopOK1: (int){ |(*(int){ 2 }, (int){ &(matchN(1, (#list){ 916 0: (int){ 2 } 917 }), int) }) } 918 pickTopOK2: (int){ &(matchN(1, (#list){ 919 0: (_|_){// 2 920 } 921 }), int) } 922 pickTopErr: (int){ &(matchN(1, (#list){ 923 0: (int){ 2 } 924 }), int) } 925 pickNested1OK1: (struct){ 926 a: (int){ |(*(int){ 2 }, (int){ int }) } 927 } 928 pickNested1OK2: (struct){ 929 a: (int){ int } 930 } 931 pickNested1Err: (_|_){ 932 // [eval] match.defaults.pickNested1Err.a: conflicting values 2 and 3: 933 // ./in.cue:36:23 934 // ./in.cue:36:38 935 // ./in.cue:39:23 936 // match.defaults.pickNested1Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 937 // ./in.cue:36:23 938 // ./in.cue:36:30 939 // ./in.cue:39:19 940 a: (int){ |(*(int){ 3 }, (int){ int }) } 941 } 942 pickNested2OK1: (struct){ 943 a: (int){ |(*(int){ 2 }, (int){ int }) } 944 } 945 pickNested2OK2: (struct){ 946 a: (int){ int } 947 } 948 pickNested2Err: (_|_){ 949 // [eval] match.defaults.pickNested2Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 950 // ./in.cue:41:23 951 // ./in.cue:41:30 952 // ./in.cue:44:19 953 // match.defaults.pickNested2Err.a: invalid value 3 (out of bound <=2): 954 // ./in.cue:41:38 955 // ./in.cue:44:23 956 a: (int){ |(*(int){ 3 }, (int){ int }) } 957 } 958 } 959 nestedOK: (struct){ 960 a: (int){ 2 } 961 b: (struct){ 962 a: (int){ 3 } 963 b: (struct){ 964 a: (int){ 4 } 965 } 966 c: (struct){ 967 a: (int){ 5 } 968 } 969 } 970 c: (struct){ 971 a: (int){ 3 } 972 b: (struct){ 973 a: (int){ 4 } 974 } 975 c: (struct){ 976 a: (int){ 5 } 977 } 978 } 979 } 980 } 981 not: (_|_){ 982 // [eval] 983 singleOK: (struct){ 984 a: (string){ "foo" } 985 } 986 singleErr: (_|_){ 987 // [eval] not.singleErr: invalid value {a:2} (does not satisfy matchN): 1 matched, expected 0: 988 // ./in.cue:74:17 989 // ./in.cue:74:24 990 // ./in.cue:76:13 991 a: (int){ 2 } 992 } 993 doubleOK: (struct){ 994 a: (int){ 2 } 995 } 996 doubleErr: (_|_){ 997 // [eval] not.doubleErr: invalid value {a:"foo"} (does not satisfy matchN): 1 matched, expected 0: 998 // ./in.cue:78:17 999 // ./in.cue:78:24 1000 // ./in.cue:80:13 1001 a: (string){ "foo" } 1002 } 1003 } 1004 oneOf: (_|_){ 1005 // [eval] 1006 multiple1Err1: (_|_){ 1007 // [eval] oneOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 1: 1008 // ./in.cue:84:20 1009 // ./in.cue:84:27 1010 // ./in.cue:86:17 1011 // oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 1012 // ./in.cue:84:31 1013 // ./in.cue:84:20 1014 // ./in.cue:84:47 1015 // ./in.cue:86:17 1016 // oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 1017 // ./in.cue:84:51 1018 // ./in.cue:84:20 1019 // ./in.cue:84:67 1020 // ./in.cue:86:17 1021 } 1022 multiple1OK1: (int){ 3 } 1023 multiple1OK2: (int){ 5 } 1024 multiple1Err2: (_|_){ 1025 // [eval] oneOf.multiple1Err2: invalid value 15 (does not satisfy matchN): 2 matched, expected 1: 1026 // ./in.cue:84:20 1027 // ./in.cue:84:27 1028 // ./in.cue:91:17 1029 } 1030 } 1031 anyOf: (_|_){ 1032 // [eval] 1033 multiple1Err1: (_|_){ 1034 // [eval] anyOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected >0: 1035 // ./in.cue:95:20 1036 // ./in.cue:95:27 1037 // ./in.cue:97:17 1038 // anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 1039 // ./in.cue:95:32 1040 // ./in.cue:95:20 1041 // ./in.cue:95:48 1042 // ./in.cue:97:17 1043 // anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 1044 // ./in.cue:95:52 1045 // ./in.cue:95:20 1046 // ./in.cue:95:68 1047 // ./in.cue:97:17 1048 } 1049 multiple1OK1: (int){ 3 } 1050 multiple1OK2: (int){ 5 } 1051 multiple1OK3: (int){ 15 } 1052 } 1053 allOf: (_|_){ 1054 // [eval] 1055 multiple1Err1: (_|_){ 1056 // [eval] allOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 2: 1057 // ./in.cue:106:20 1058 // ./in.cue:106:27 1059 // ./in.cue:108:17 1060 // allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 1061 // ./in.cue:106:31 1062 // ./in.cue:106:20 1063 // ./in.cue:106:47 1064 // ./in.cue:108:17 1065 // allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 1066 // ./in.cue:106:51 1067 // ./in.cue:106:20 1068 // ./in.cue:106:67 1069 // ./in.cue:108:17 1070 } 1071 multiple1Err2: (_|_){ 1072 // [eval] allOf.multiple1Err2: invalid value 3 (does not satisfy matchN): 1 matched, expected 2: 1073 // ./in.cue:106:20 1074 // ./in.cue:106:27 1075 // ./in.cue:109:17 1076 // allOf.multiple1Err2: invalid value 3 (does not satisfy math.MultipleOf(5)): 1077 // ./in.cue:106:51 1078 // ./in.cue:106:20 1079 // ./in.cue:106:67 1080 // ./in.cue:109:17 1081 } 1082 multiple1Err3: (_|_){ 1083 // [eval] allOf.multiple1Err3: invalid value 5 (does not satisfy matchN): 1 matched, expected 2: 1084 // ./in.cue:106:20 1085 // ./in.cue:106:27 1086 // ./in.cue:110:17 1087 // allOf.multiple1Err3: invalid value 5 (does not satisfy math.MultipleOf(3)): 1088 // ./in.cue:106:31 1089 // ./in.cue:106:20 1090 // ./in.cue:106:47 1091 // ./in.cue:110:17 1092 } 1093 multiple1OK1: (int){ 15 } 1094 } 1095 bare: (struct){ 1096 embed: (struct){ 1097 t1: (struct){ 1098 a: (_){ matchN(1, (#list){ 1099 0: (_|_){// >10 1100 } 1101 }) } 1102 b: (_){ matchN(1, (#list){ 1103 0: (_|_){// >10 1104 } 1105 }) } 1106 } 1107 t2: (struct){ 1108 b: (_){ matchN(1, (#list){ 1109 0: (_|_){// >10 1110 } 1111 }) } 1112 a: (_){ matchN(1, (#list){ 1113 0: (_|_){// >10 1114 } 1115 }) } 1116 } 1117 } 1118 direct: (struct){ 1119 t1: (struct){ 1120 a: (_){ matchN(1, (#list){ 1121 0: (_|_){// >10 1122 } 1123 }) } 1124 b: (_){ matchN(1, (#list){ 1125 0: (_|_){// >10 1126 } 1127 }) } 1128 } 1129 t2: (struct){ 1130 b: (_){ matchN(1, (#list){ 1131 0: (_|_){// >10 1132 } 1133 }) } 1134 a: (_){ matchN(1, (#list){ 1135 0: (_|_){// >10 1136 } 1137 }) } 1138 } 1139 } 1140 } 1141 required: (struct){ 1142 ok1: (struct){ 1143 x: (struct){ 1144 bar: (int){ 2 } 1145 } 1146 } 1147 ok2: (struct){ 1148 x: (_){ matchN(0, (#list){ 1149 0: (_|_){// { 1150 // foo!: string 1151 // } 1152 } 1153 }) } 1154 } 1155 ok3: (struct){ 1156 x: (struct){ 1157 bar: (int){ 2 } 1158 } 1159 } 1160 } 1161 issue3575: (_|_){ 1162 // [eval] 1163 test1: (_|_){ 1164 // [eval] 1165 #x: (_){ matchN(1, (#list){ 1166 0: (_|_){// [ 1167 // {}, 1168 // ] 1169 } 1170 }) } 1171 x: (_|_){ 1172 // [eval] issue3575.test1.x: invalid value [{a:1}] (does not satisfy matchN): 0 matched, expected 1: 1173 // ./in.cue:153:7 1174 // ./in.cue:153:14 1175 // ./in.cue:156:6 1176 // ./in.cue:157:6 1177 // issue3575.test1.x.0.a: field not allowed: 1178 // ./in.cue:153:7 1179 // ./in.cue:154:4 1180 // ./in.cue:154:5 1181 // ./in.cue:156:6 1182 // ./in.cue:157:8 1183 0: (struct){ 1184 a: (int){ 1 } 1185 } 1186 } 1187 } 1188 test2: (struct){ 1189 #x: (_){ matchN(1, (#list){ 1190 0: (_|_){// {} 1191 } 1192 }) } 1193 x: (struct){ 1194 a: (int){ 1 } 1195 } 1196 } 1197 } 1198 incomplete: (_|_){ 1199 // [eval] 1200 incomplete1: (struct){ 1201 x: (_|_){ 1202 // [incomplete] incomplete.incomplete1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 1203 // ./incomplete.cue:7:6 1204 // ./incomplete.cue:7:13 1205 // ./incomplete.cue:8:6 1206 // incomplete.incomplete1.x.foo: field is required but not present: 1207 // ./incomplete.cue:7:6 1208 // ./incomplete.cue:7:18 1209 bar: (int){ 2 } 1210 } 1211 } 1212 incomplete2: (struct){ 1213 x: (_){ matchN(1, (#list){ 1214 0: (_|_){// { 1215 // foo!: string 1216 // } 1217 } 1218 }) } 1219 } 1220 incomplete3: (struct){ 1221 x: (_|_){ 1222 // [incomplete] incomplete.incomplete3.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected math.MultipleOf(2): 1223 // ./incomplete.cue:16:6 1224 // ./incomplete.cue:16:13 1225 // ./incomplete.cue:17:6 1226 // incomplete.incomplete3.x.foo: field is required but not present: 1227 // ./incomplete.cue:16:6 1228 // ./incomplete.cue:16:48 1229 bar: (int){ 2 } 1230 } 1231 } 1232 incomplete4: (struct){ 1233 x: (_|_){ 1234 // [incomplete] incomplete.incomplete4.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected math.MultipleOf(2): 1235 // ./incomplete.cue:20:6 1236 // ./incomplete.cue:20:13 1237 // ./incomplete.cue:21:6 1238 // incomplete.incomplete4.x.baz: field is required but not present: 1239 // ./incomplete.cue:20:6 1240 // ./incomplete.cue:20:61 1241 // incomplete.incomplete4.x.foo: field is required but not present: 1242 // ./incomplete.cue:20:6 1243 // ./incomplete.cue:20:48 1244 bar: (int){ 2 } 1245 } 1246 } 1247 incomplete5: (struct){ 1248 x: (_|_){ 1249 // [incomplete] incomplete.incomplete5.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected >1 & <=3: 1250 // ./incomplete.cue:24:6 1251 // ./incomplete.cue:24:13 1252 // ./incomplete.cue:25:6 1253 // incomplete.incomplete5.x.baz: field is required but not present: 1254 // ./incomplete.cue:24:6 1255 // ./incomplete.cue:24:51 1256 // incomplete.incomplete5.x.foo: field is required but not present: 1257 // ./incomplete.cue:24:6 1258 // ./incomplete.cue:24:38 1259 bar: (int){ 2 } 1260 } 1261 } 1262 incomplete6: (struct){ 1263 x: (_|_){ 1264 // [incomplete] incomplete.incomplete6.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected 2 | 3: 1265 // ./incomplete.cue:28:6 1266 // ./incomplete.cue:28:13 1267 // ./incomplete.cue:29:6 1268 // incomplete.incomplete6.x.baz: field is required but not present: 1269 // ./incomplete.cue:28:6 1270 // ./incomplete.cue:28:46 1271 // incomplete.incomplete6.x.foo: field is required but not present: 1272 // ./incomplete.cue:28:6 1273 // ./incomplete.cue:28:33 1274 bar: (int){ 2 } 1275 } 1276 } 1277 err1: (_|_){ 1278 // [eval] 1279 x: (_|_){ 1280 // [eval] incomplete.err1.x.bar: conflicting values 2 and string (mismatched types int and string): 1281 // ./incomplete.cue:34:24 1282 // ./incomplete.cue:35:11 1283 // incomplete.err1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 1284 // ./incomplete.cue:34:6 1285 // ./incomplete.cue:34:13 1286 // ./incomplete.cue:35:6 1287 bar: (int){ 2 } 1288 } 1289 } 1290 err2: (_|_){ 1291 // [eval] 1292 x: (_|_){ 1293 // [eval] incomplete.err2.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected 0: 1294 // ./incomplete.cue:40:6 1295 // ./incomplete.cue:40:13 1296 // ./incomplete.cue:41:6 1297 bar: (int){ 2 } 1298 } 1299 } 1300 err3: (_|_){ 1301 // [eval] 1302 x: (_|_){ 1303 // [eval] incomplete.err3.x.bar: conflicting values 2 and string (mismatched types int and string): 1304 // ./incomplete.cue:46:24 1305 // ./incomplete.cue:47:11 1306 // incomplete.err3.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 2: 1307 // ./incomplete.cue:46:6 1308 // ./incomplete.cue:46:13 1309 // ./incomplete.cue:47:6 1310 bar: (int){ 2 } 1311 } 1312 } 1313 err4: (_|_){ 1314 // [eval] 1315 x: (_|_){ 1316 // [eval] incomplete.err4.x.bar: conflicting values 2 and string (mismatched types int and string): 1317 // ./incomplete.cue:51:25 1318 // ./incomplete.cue:52:11 1319 // incomplete.err4.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected >1: 1320 // ./incomplete.cue:51:6 1321 // ./incomplete.cue:51:13 1322 // ./incomplete.cue:52:6 1323 bar: (int){ 2 } 1324 } 1325 } 1326 err5: (_|_){ 1327 // [eval] 1328 x: (_|_){ 1329 // [eval] incomplete.err5.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected <1: 1330 // ./incomplete.cue:55:6 1331 // ./incomplete.cue:55:13 1332 // ./incomplete.cue:56:6 1333 bar: (int){ 2 } 1334 } 1335 } 1336 } 1337 issue3389: (struct){ 1338 x: (_|_){ 1339 // [incomplete] issue3389.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 1340 // ./incomplete.cue:62:5 1341 // ./incomplete.cue:61:5 1342 // ./incomplete.cue:62:12 1343 // issue3389.x.foo: field is required but not present: 1344 // ./incomplete.cue:62:5 1345 // ./incomplete.cue:62:35 1346 bar: (int){ 2 } 1347 } 1348 } 1349 issue3694: (struct){ 1350 full: (struct){ 1351 #step: (_|_){ 1352 // [incomplete] issue3694.full.#step: invalid value {uses?:string,run?:string} (does not satisfy matchN): 0 matched, expected 1: 1353 // ./issue3694.cue:2:9 1354 // ./issue3694.cue:2:16 1355 // ./issue3694.cue:9:9 1356 // issue3694.full.#step.run: field is required but not present: 1357 // ./issue3694.cue:2:9 1358 // ./issue3694.cue:6:3 1359 // issue3694.full.#step.uses: field is required but not present: 1360 // ./issue3694.cue:2:9 1361 // ./issue3694.cue:3:3 1362 uses?: (string){ string } 1363 run?: (string){ string } 1364 } 1365 s: (#struct){ 1366 uses?: (string){ string } 1367 run: (string){ "echo hello world" } 1368 } 1369 } 1370 simple: (struct){ 1371 #step: (_|_){ 1372 // [incomplete] issue3694.simple.#step: invalid value {uses?:string} (does not satisfy matchN): 0 matched, expected 1: 1373 // ./issue3694.cue:19:9 1374 // ./issue3694.cue:19:16 1375 // ./issue3694.cue:22:9 1376 // issue3694.simple.#step.uses: field is required but not present: 1377 // ./issue3694.cue:19:9 1378 // ./issue3694.cue:20:3 1379 uses?: (string){ string } 1380 } 1381 } 1382 } 1383 } 1384 -- out/evalalpha -- 1385 Errors: 1386 closedByDefinition.err5.out.exports: conflicting values null and {exp1:"./main-module.js"} (mismatched types null and struct): 1387 ./closedness.cue:80:13 1388 ./closedness.cue:80:24 1389 ./closedness.cue:86:12 1390 closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and null (mismatched types string and null): 1391 ./closedness.cue:81:24 1392 ./closedness.cue:86:18 1393 closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and {exp1?:#exports} (mismatched types string and struct): 1394 ./closedness.cue:82:19 1395 ./closedness.cue:86:18 1396 explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 1397 ./closedness.cue:33:6 1398 ./closedness.cue:33:17 1399 ./closedness.cue:36:6 1400 incomplete.err1.x.bar: conflicting values 2 and string (mismatched types int and string): 1401 ./incomplete.cue:34:24 1402 ./incomplete.cue:35:11 1403 incomplete.err3.x.bar: conflicting values 2 and string (mismatched types int and string): 1404 ./incomplete.cue:46:24 1405 ./incomplete.cue:47:11 1406 incomplete.err4.x.bar: conflicting values 2 and string (mismatched types int and string): 1407 ./incomplete.cue:51:25 1408 ./incomplete.cue:52:11 1409 match.defaults.pickNested1Err.a: conflicting values 2 and 3: 1410 ./in.cue:36:38 1411 ./in.cue:39:23 1412 match.incompleteErr.a: conflicting values string and int (mismatched types string and int): 1413 ./in.cue:4:5 1414 ./in.cue:14:20 1415 match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): 1416 ./in.cue:4:5 1417 ./in.cue:10:16 1418 openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 1419 ./closedness.cue:21:13 1420 ./closedness.cue:22:5 1421 ./closedness.cue:28:6 1422 openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 1423 ./closedness.cue:21:13 1424 ./closedness.cue:21:20 1425 ./closedness.cue:28:6 1426 explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 1427 ./closedness.cue:33:6 1428 ./closedness.cue:33:13 1429 ./closedness.cue:36:6 1430 explicitClose.err1.out.a.baz: field not allowed: 1431 ./closedness.cue:33:6 1432 ./closedness.cue:36:11 1433 closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 1434 ./closedness.cue:80:13 1435 ./closedness.cue:80:20 1436 ./closedness.cue:86:12 1437 closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 1438 ./closedness.cue:81:13 1439 ./closedness.cue:81:20 1440 ./closedness.cue:82:26 1441 ./closedness.cue:86:18 1442 match.singleErr: invalid value {a:"foo"} (does not satisfy matchN): 0 matched, expected 1: 1443 ./in.cue:8:17 1444 ./in.cue:8:24 1445 ./in.cue:10:13 1446 match.incompleteErr: invalid value {a:string} (does not satisfy matchN): 0 matched, expected 1: 1447 ./in.cue:12:21 1448 ./in.cue:12:28 1449 ./in.cue:14:17 1450 match.defaults.pickNested1Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 1451 ./in.cue:36:23 1452 ./in.cue:36:30 1453 ./in.cue:39:19 1454 match.defaults.pickNested2Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 1455 ./in.cue:41:23 1456 ./in.cue:41:30 1457 ./in.cue:44:19 1458 match.defaults.pickNested2Err.a: invalid value 3 (out of bound <=2): 1459 ./in.cue:41:38 1460 ./in.cue:44:23 1461 not.singleErr: invalid value {a:2} (does not satisfy matchN): 1 matched, expected 0: 1462 ./in.cue:74:17 1463 ./in.cue:74:24 1464 ./in.cue:76:13 1465 not.doubleErr: invalid value {a:"foo"} (does not satisfy matchN): 1 matched, expected 0: 1466 ./in.cue:78:17 1467 ./in.cue:78:24 1468 ./in.cue:80:13 1469 oneOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 1: 1470 ./in.cue:84:20 1471 ./in.cue:84:27 1472 ./in.cue:86:17 1473 oneOf.multiple1Err2: invalid value 15 (does not satisfy matchN): 2 matched, expected 1: 1474 ./in.cue:84:20 1475 ./in.cue:84:27 1476 ./in.cue:91:17 1477 oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 1478 ./in.cue:84:31 1479 ./in.cue:84:20 1480 ./in.cue:84:47 1481 ./in.cue:86:17 1482 oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 1483 ./in.cue:84:51 1484 ./in.cue:84:20 1485 ./in.cue:84:67 1486 ./in.cue:86:17 1487 anyOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected >0: 1488 ./in.cue:95:20 1489 ./in.cue:95:27 1490 ./in.cue:97:17 1491 anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 1492 ./in.cue:95:32 1493 ./in.cue:95:20 1494 ./in.cue:95:48 1495 ./in.cue:97:17 1496 anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 1497 ./in.cue:95:52 1498 ./in.cue:95:20 1499 ./in.cue:95:68 1500 ./in.cue:97:17 1501 allOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 2: 1502 ./in.cue:106:20 1503 ./in.cue:106:27 1504 ./in.cue:108:17 1505 allOf.multiple1Err2: invalid value 3 (does not satisfy matchN): 1 matched, expected 2: 1506 ./in.cue:106:20 1507 ./in.cue:106:27 1508 ./in.cue:109:17 1509 allOf.multiple1Err3: invalid value 5 (does not satisfy matchN): 1 matched, expected 2: 1510 ./in.cue:106:20 1511 ./in.cue:106:27 1512 ./in.cue:110:17 1513 allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 1514 ./in.cue:106:31 1515 ./in.cue:106:20 1516 ./in.cue:106:47 1517 ./in.cue:108:17 1518 allOf.multiple1Err3: invalid value 5 (does not satisfy math.MultipleOf(3)): 1519 ./in.cue:106:31 1520 ./in.cue:106:20 1521 ./in.cue:106:47 1522 ./in.cue:110:17 1523 allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 1524 ./in.cue:106:51 1525 ./in.cue:106:20 1526 ./in.cue:106:67 1527 ./in.cue:108:17 1528 allOf.multiple1Err2: invalid value 3 (does not satisfy math.MultipleOf(5)): 1529 ./in.cue:106:51 1530 ./in.cue:106:20 1531 ./in.cue:106:67 1532 ./in.cue:109:17 1533 incomplete.err1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 1534 ./incomplete.cue:34:6 1535 ./incomplete.cue:34:13 1536 ./incomplete.cue:35:6 1537 incomplete.err2.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected 0: 1538 ./incomplete.cue:40:6 1539 ./incomplete.cue:40:13 1540 ./incomplete.cue:41:6 1541 incomplete.err3.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 2: 1542 ./incomplete.cue:46:6 1543 ./incomplete.cue:46:13 1544 ./incomplete.cue:47:6 1545 incomplete.err4.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected >1: 1546 ./incomplete.cue:51:6 1547 ./incomplete.cue:51:13 1548 ./incomplete.cue:52:6 1549 incomplete.err5.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected <1: 1550 ./incomplete.cue:55:6 1551 ./incomplete.cue:55:13 1552 ./incomplete.cue:56:6 1553 1554 Result: 1555 (_|_){ 1556 // [eval] 1557 ellipsis: (struct){ 1558 ok: (struct){ 1559 out: (#struct){ 1560 field: (#struct){ 1561 shouldBeAllowed: (int){ 123 } 1562 } 1563 #anything: (_){ matchN(1, (#list){ 1564 0: (_|_){// { 1565 // ... 1566 // } 1567 } 1568 }) } 1569 } 1570 #Schema: (#struct){ 1571 field?: (_){ matchN(1, (#list){ 1572 0: (_|_){// { 1573 // ... 1574 // } 1575 } 1576 }) } 1577 #anything: (_){ matchN(1, (#list){ 1578 0: (_|_){// { 1579 // ... 1580 // } 1581 } 1582 }) } 1583 } 1584 } 1585 } 1586 openArguments: (_|_){ 1587 // [eval] 1588 ok1: (struct){ 1589 #Schema: (#struct){ 1590 a: (_){ matchN(1, (#list){ 1591 0: (_|_){// "all" 1592 } 1593 1: (_|_){// { 1594 // foo: "bar" 1595 // } 1596 } 1597 }) } 1598 } 1599 out: (#struct){ 1600 a: (#struct){ 1601 baz: (string){ "allowed" } 1602 } 1603 } 1604 } 1605 err2: (_|_){ 1606 // [eval] 1607 #Schema: (#struct){ 1608 a?: (_){ matchN(1, (#list){ 1609 0: (_|_){// null 1610 } 1611 1: (_|_){// { 1612 // [string]: string 1613 // } 1614 } 1615 2: (_|_){// { 1616 // b: { 1617 // ... 1618 // } 1619 // } 1620 } 1621 }) } 1622 } 1623 out: (_|_){ 1624 // [eval] 1625 a: (_|_){ 1626 // [eval] openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 1627 // ./closedness.cue:21:13 1628 // ./closedness.cue:22:5 1629 // ./closedness.cue:28:6 1630 // openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 1631 // ./closedness.cue:21:13 1632 // ./closedness.cue:21:20 1633 // ./closedness.cue:28:6 1634 allowed: (string){ "once" } 1635 } 1636 } 1637 } 1638 } 1639 explicitClose: (_|_){ 1640 // [eval] 1641 err1: (_|_){ 1642 // [eval] 1643 #Schema: (#struct){ 1644 a: (_){ matchN(1, (#list){ 1645 0: (_|_){// "all" 1646 } 1647 1: (_|_){// close({ 1648 // foo: "bar" 1649 // }) 1650 } 1651 }) } 1652 } 1653 out: (_|_){ 1654 // [eval] 1655 a: (_|_){ 1656 // [eval] explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 1657 // ./closedness.cue:33:6 1658 // ./closedness.cue:33:17 1659 // ./closedness.cue:36:6 1660 // explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 1661 // ./closedness.cue:33:6 1662 // ./closedness.cue:33:13 1663 // ./closedness.cue:36:6 1664 // explicitClose.err1.out.a.baz: field not allowed: 1665 // ./closedness.cue:33:6 1666 // ./closedness.cue:36:11 1667 baz: (string){ "notAllowed" } 1668 } 1669 } 1670 } 1671 ok2: (struct){ 1672 #Schema: (#struct){ 1673 a?: (_){ matchN(1, (#list){ 1674 0: (_|_){// null 1675 } 1676 1: (_|_){// close({ 1677 // [string]: string 1678 // }) 1679 } 1680 2: (_|_){// close({ 1681 // b: { 1682 // ... 1683 // } 1684 // }) 1685 } 1686 }) } 1687 } 1688 out: (#struct){ 1689 a: (#struct){ 1690 allowed: (string){ "once" } 1691 } 1692 } 1693 } 1694 } 1695 mixed: (struct){ 1696 ok3: (struct){ 1697 #Schema: (#struct){ 1698 exports?: (_){ matchN(1, (#list){ 1699 0: (_|_){// close({ 1700 // never?: _ 1701 // }) 1702 } 1703 1: (_|_){// 〈1;#exportsObject〉 1704 } 1705 }) } 1706 #exports: (_){ matchN(1, (#list){ 1707 0: (_|_){// string 1708 } 1709 1: (_|_){// 〈1;#exportsObject〉 1710 } 1711 }) } 1712 #exportsObject: (#struct){ 1713 exp1?: (_){ matchN(1, (#list){ 1714 0: (_|_){// string 1715 } 1716 1: (_|_){// 〈1;#exportsObject〉 1717 } 1718 }) } 1719 } 1720 } 1721 out: (#struct){ 1722 exports: (#struct){ 1723 exp1: (string){ "./main-module.js" } 1724 } 1725 #exports: (_){ matchN(1, (#list){ 1726 0: (_|_){// string 1727 } 1728 1: (_|_){// 〈1;#exportsObject〉 1729 } 1730 }) } 1731 #exportsObject: (#struct){ 1732 exp1?: (_){ matchN(1, (#list){ 1733 0: (_|_){// string 1734 } 1735 1: (_|_){// 〈1;#exportsObject〉 1736 } 1737 }) } 1738 } 1739 } 1740 } 1741 } 1742 closedByDefinition: (_|_){ 1743 // [eval] 1744 ok4: (struct){ 1745 #Schema: (#struct){ 1746 exports?: (_){ matchN(1, (#list){ 1747 0: (_|_){// string 1748 } 1749 1: (_|_){// 〈1;#exportsObject〉 1750 } 1751 }) } 1752 #exports: (_){ matchN(1, (#list){ 1753 0: (_|_){// string 1754 } 1755 1: (_|_){// 〈1;#exportsObject〉 1756 } 1757 }) } 1758 #exportsObject: (#struct){ 1759 exp1?: (_){ matchN(1, (#list){ 1760 0: (_|_){// string 1761 } 1762 1: (_|_){// 〈1;#exportsObject〉 1763 } 1764 }) } 1765 } 1766 } 1767 out: (#struct){ 1768 exports: (#struct){ 1769 exp1: (string){ "./main-module.js" } 1770 } 1771 #exports: (_){ matchN(1, (#list){ 1772 0: (_|_){// string 1773 } 1774 1: (_|_){// 〈1;#exportsObject〉 1775 } 1776 }) } 1777 #exportsObject: (#struct){ 1778 exp1?: (_){ matchN(1, (#list){ 1779 0: (_|_){// string 1780 } 1781 1: (_|_){// 〈1;#exportsObject〉 1782 } 1783 }) } 1784 } 1785 } 1786 } 1787 err5: (_|_){ 1788 // [eval] 1789 #Schema: (#struct){ 1790 exports?: (_){ matchN(1, (#list){ 1791 0: (_|_){// null 1792 } 1793 1: (_|_){// 〈1;#exportsObject〉 1794 } 1795 }) } 1796 #exports: (_){ matchN(1, (#list){ 1797 0: (_|_){// null 1798 } 1799 1: (_|_){// 〈1;#exportsObject〉 1800 } 1801 }) } 1802 #exportsObject: (#struct){ 1803 exp1?: (_){ matchN(1, (#list){ 1804 0: (_|_){// null 1805 } 1806 1: (_|_){// 〈1;#exportsObject〉 1807 } 1808 }) } 1809 } 1810 } 1811 out: (_|_){ 1812 // [eval] 1813 exports: (_|_){ 1814 // [eval] closedByDefinition.err5.out.exports: conflicting values null and {exp1:"./main-module.js"} (mismatched types null and struct): 1815 // ./closedness.cue:80:13 1816 // ./closedness.cue:80:24 1817 // ./closedness.cue:86:12 1818 // closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and null (mismatched types string and null): 1819 // ./closedness.cue:81:24 1820 // ./closedness.cue:86:18 1821 // closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and {exp1?:#exports} (mismatched types string and struct): 1822 // ./closedness.cue:82:19 1823 // ./closedness.cue:86:18 1824 // closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 1825 // ./closedness.cue:80:13 1826 // ./closedness.cue:80:20 1827 // ./closedness.cue:86:12 1828 // closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 1829 // ./closedness.cue:81:13 1830 // ./closedness.cue:81:20 1831 // ./closedness.cue:82:26 1832 // ./closedness.cue:86:18 1833 exp1: (string){ "./main-module.js" } 1834 } 1835 #exports: (_){ matchN(1, (#list){ 1836 0: (_|_){// null 1837 } 1838 1: (_|_){// 〈1;#exportsObject〉 1839 } 1840 }) } 1841 #exportsObject: (#struct){ 1842 exp1?: (_){ matchN(1, (#list){ 1843 0: (_|_){// null 1844 } 1845 1: (_|_){// 〈1;#exportsObject〉 1846 } 1847 }) } 1848 } 1849 } 1850 } 1851 } 1852 #Foo: (#struct){ 1853 a: (int){ int } 1854 } 1855 match: (_|_){ 1856 // [eval] 1857 singleOK: (struct){ 1858 a: (int){ 2 } 1859 } 1860 singleErr: (_|_){ 1861 // [eval] match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): 1862 // ./in.cue:4:5 1863 // ./in.cue:10:16 1864 // match.singleErr: invalid value {a:"foo"} (does not satisfy matchN): 0 matched, expected 1: 1865 // ./in.cue:8:17 1866 // ./in.cue:8:24 1867 // ./in.cue:10:13 1868 a: (string){ "foo" } 1869 } 1870 incompleteOK: (struct){ 1871 a: (int){ int } 1872 } 1873 incompleteErr: (_|_){ 1874 // [eval] match.incompleteErr.a: conflicting values string and int (mismatched types string and int): 1875 // ./in.cue:4:5 1876 // ./in.cue:14:20 1877 // match.incompleteErr: invalid value {a:string} (does not satisfy matchN): 0 matched, expected 1: 1878 // ./in.cue:12:21 1879 // ./in.cue:12:28 1880 // ./in.cue:14:17 1881 a: (string){ string } 1882 } 1883 #A: (#struct){ 1884 a: (int){ int } 1885 b: (_){ _ } 1886 } 1887 defaults: (_|_){ 1888 // [eval] 1889 pickTopOK1: (int){ |(*(int){ 2 }, (int){ &(matchN(1, (#list){ 1890 0: (int){ 2 } 1891 }), int) }) } 1892 pickTopOK2: (int){ &(matchN(1, (#list){ 1893 0: (_|_){// 2 1894 } 1895 }), int) } 1896 pickTopErr: (int){ &(matchN(1, (#list){ 1897 0: (int){ 2 } 1898 }), int) } 1899 pickNested1OK1: (struct){ 1900 a: (int){ |(*(int){ 2 }, (int){ int }) } 1901 } 1902 pickNested1OK2: (struct){ 1903 a: (int){ int } 1904 } 1905 pickNested1Err: (_|_){ 1906 // [eval] match.defaults.pickNested1Err.a: conflicting values 2 and 3: 1907 // ./in.cue:36:38 1908 // ./in.cue:39:23 1909 // match.defaults.pickNested1Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 1910 // ./in.cue:36:23 1911 // ./in.cue:36:30 1912 // ./in.cue:39:19 1913 a: (int){ |(*(int){ 3 }, (int){ int }) } 1914 } 1915 pickNested2OK1: (struct){ 1916 a: (int){ |(*(int){ 2 }, (int){ int }) } 1917 } 1918 pickNested2OK2: (struct){ 1919 a: (int){ int } 1920 } 1921 pickNested2Err: (_|_){ 1922 // [eval] match.defaults.pickNested2Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 1923 // ./in.cue:41:23 1924 // ./in.cue:41:30 1925 // ./in.cue:44:19 1926 // match.defaults.pickNested2Err.a: invalid value 3 (out of bound <=2): 1927 // ./in.cue:41:38 1928 // ./in.cue:44:23 1929 a: (int){ |(*(int){ 3 }, (int){ int }) } 1930 } 1931 } 1932 nestedOK: (struct){ 1933 a: (int){ 2 } 1934 b: (struct){ 1935 a: (int){ 3 } 1936 b: (struct){ 1937 a: (int){ 4 } 1938 } 1939 c: (struct){ 1940 a: (int){ 5 } 1941 } 1942 } 1943 c: (struct){ 1944 a: (int){ 3 } 1945 b: (struct){ 1946 a: (int){ 4 } 1947 } 1948 c: (struct){ 1949 a: (int){ 5 } 1950 } 1951 } 1952 } 1953 } 1954 not: (_|_){ 1955 // [eval] 1956 singleOK: (struct){ 1957 a: (string){ "foo" } 1958 } 1959 singleErr: (_|_){ 1960 // [eval] not.singleErr: invalid value {a:2} (does not satisfy matchN): 1 matched, expected 0: 1961 // ./in.cue:74:17 1962 // ./in.cue:74:24 1963 // ./in.cue:76:13 1964 a: (int){ 2 } 1965 } 1966 doubleOK: (struct){ 1967 a: (int){ 2 } 1968 } 1969 doubleErr: (_|_){ 1970 // [eval] not.doubleErr: invalid value {a:"foo"} (does not satisfy matchN): 1 matched, expected 0: 1971 // ./in.cue:78:17 1972 // ./in.cue:78:24 1973 // ./in.cue:80:13 1974 a: (string){ "foo" } 1975 } 1976 } 1977 oneOf: (_|_){ 1978 // [eval] 1979 multiple1Err1: (_|_){ 1980 // [eval] oneOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 1: 1981 // ./in.cue:84:20 1982 // ./in.cue:84:27 1983 // ./in.cue:86:17 1984 // oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 1985 // ./in.cue:84:31 1986 // ./in.cue:84:20 1987 // ./in.cue:84:47 1988 // ./in.cue:86:17 1989 // oneOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 1990 // ./in.cue:84:51 1991 // ./in.cue:84:20 1992 // ./in.cue:84:67 1993 // ./in.cue:86:17 1994 } 1995 multiple1OK1: (int){ 3 } 1996 multiple1OK2: (int){ 5 } 1997 multiple1Err2: (_|_){ 1998 // [eval] oneOf.multiple1Err2: invalid value 15 (does not satisfy matchN): 2 matched, expected 1: 1999 // ./in.cue:84:20 2000 // ./in.cue:84:27 2001 // ./in.cue:91:17 2002 } 2003 } 2004 anyOf: (_|_){ 2005 // [eval] 2006 multiple1Err1: (_|_){ 2007 // [eval] anyOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected >0: 2008 // ./in.cue:95:20 2009 // ./in.cue:95:27 2010 // ./in.cue:97:17 2011 // anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 2012 // ./in.cue:95:32 2013 // ./in.cue:95:20 2014 // ./in.cue:95:48 2015 // ./in.cue:97:17 2016 // anyOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 2017 // ./in.cue:95:52 2018 // ./in.cue:95:20 2019 // ./in.cue:95:68 2020 // ./in.cue:97:17 2021 } 2022 multiple1OK1: (int){ 3 } 2023 multiple1OK2: (int){ 5 } 2024 multiple1OK3: (int){ 15 } 2025 } 2026 allOf: (_|_){ 2027 // [eval] 2028 multiple1Err1: (_|_){ 2029 // [eval] allOf.multiple1Err1: invalid value 1 (does not satisfy matchN): 0 matched, expected 2: 2030 // ./in.cue:106:20 2031 // ./in.cue:106:27 2032 // ./in.cue:108:17 2033 // allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(3)): 2034 // ./in.cue:106:31 2035 // ./in.cue:106:20 2036 // ./in.cue:106:47 2037 // ./in.cue:108:17 2038 // allOf.multiple1Err1: invalid value 1 (does not satisfy math.MultipleOf(5)): 2039 // ./in.cue:106:51 2040 // ./in.cue:106:20 2041 // ./in.cue:106:67 2042 // ./in.cue:108:17 2043 } 2044 multiple1Err2: (_|_){ 2045 // [eval] allOf.multiple1Err2: invalid value 3 (does not satisfy matchN): 1 matched, expected 2: 2046 // ./in.cue:106:20 2047 // ./in.cue:106:27 2048 // ./in.cue:109:17 2049 // allOf.multiple1Err2: invalid value 3 (does not satisfy math.MultipleOf(5)): 2050 // ./in.cue:106:51 2051 // ./in.cue:106:20 2052 // ./in.cue:106:67 2053 // ./in.cue:109:17 2054 } 2055 multiple1Err3: (_|_){ 2056 // [eval] allOf.multiple1Err3: invalid value 5 (does not satisfy matchN): 1 matched, expected 2: 2057 // ./in.cue:106:20 2058 // ./in.cue:106:27 2059 // ./in.cue:110:17 2060 // allOf.multiple1Err3: invalid value 5 (does not satisfy math.MultipleOf(3)): 2061 // ./in.cue:106:31 2062 // ./in.cue:106:20 2063 // ./in.cue:106:47 2064 // ./in.cue:110:17 2065 } 2066 multiple1OK1: (int){ 15 } 2067 } 2068 bare: (struct){ 2069 embed: (struct){ 2070 t1: (struct){ 2071 a: (_){ matchN(1, (#list){ 2072 0: (_|_){// >10 2073 } 2074 }) } 2075 b: (_){ matchN(1, (#list){ 2076 0: (_|_){// >10 2077 } 2078 }) } 2079 } 2080 t2: (struct){ 2081 b: (_){ matchN(1, (#list){ 2082 0: (_|_){// >10 2083 } 2084 }) } 2085 a: (_){ matchN(1, (#list){ 2086 0: (_|_){// >10 2087 } 2088 }) } 2089 } 2090 } 2091 direct: (struct){ 2092 t1: (struct){ 2093 a: (_){ matchN(1, (#list){ 2094 0: (_|_){// >10 2095 } 2096 }) } 2097 b: (_){ matchN(1, (#list){ 2098 0: (_|_){// >10 2099 } 2100 }) } 2101 } 2102 t2: (struct){ 2103 b: (_){ matchN(1, (#list){ 2104 0: (_|_){// >10 2105 } 2106 }) } 2107 a: (_){ matchN(1, (#list){ 2108 0: (_|_){// >10 2109 } 2110 }) } 2111 } 2112 } 2113 } 2114 required: (struct){ 2115 ok1: (struct){ 2116 x: (struct){ 2117 bar: (int){ 2 } 2118 } 2119 } 2120 ok2: (struct){ 2121 x: (_){ matchN(0, (#list){ 2122 0: (_|_){// { 2123 // foo!: string 2124 // } 2125 } 2126 }) } 2127 } 2128 ok3: (struct){ 2129 x: (struct){ 2130 bar: (int){ 2 } 2131 } 2132 } 2133 } 2134 issue3575: (struct){ 2135 test1: (struct){ 2136 #x: (_){ matchN(1, (#list){ 2137 0: (_|_){// [ 2138 // {}, 2139 // ] 2140 } 2141 }) } 2142 x: (#list){ 2143 0: (struct){ 2144 a: (int){ 1 } 2145 } 2146 } 2147 } 2148 test2: (struct){ 2149 #x: (_){ matchN(1, (#list){ 2150 0: (_|_){// {} 2151 } 2152 }) } 2153 x: (#struct){ 2154 a: (int){ 1 } 2155 } 2156 } 2157 } 2158 incomplete: (_|_){ 2159 // [eval] 2160 incomplete1: (struct){ 2161 x: (_|_){ 2162 // [incomplete] incomplete.incomplete1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 2163 // ./incomplete.cue:7:6 2164 // ./incomplete.cue:7:13 2165 // ./incomplete.cue:8:6 2166 // incomplete.incomplete1.x.foo: field is required but not present: 2167 // ./incomplete.cue:7:6 2168 // ./incomplete.cue:7:18 2169 bar: (int){ 2 } 2170 } 2171 } 2172 incomplete2: (struct){ 2173 x: (_){ matchN(1, (#list){ 2174 0: (_|_){// { 2175 // foo!: string 2176 // } 2177 } 2178 }) } 2179 } 2180 incomplete3: (struct){ 2181 x: (_|_){ 2182 // [incomplete] incomplete.incomplete3.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected math.MultipleOf(2): 2183 // ./incomplete.cue:16:6 2184 // ./incomplete.cue:16:13 2185 // ./incomplete.cue:17:6 2186 // incomplete.incomplete3.x.foo: field is required but not present: 2187 // ./incomplete.cue:16:6 2188 // ./incomplete.cue:16:48 2189 bar: (int){ 2 } 2190 } 2191 } 2192 incomplete4: (struct){ 2193 x: (_|_){ 2194 // [incomplete] incomplete.incomplete4.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected math.MultipleOf(2): 2195 // ./incomplete.cue:20:6 2196 // ./incomplete.cue:20:13 2197 // ./incomplete.cue:21:6 2198 // incomplete.incomplete4.x.baz: field is required but not present: 2199 // ./incomplete.cue:20:6 2200 // ./incomplete.cue:20:61 2201 // incomplete.incomplete4.x.foo: field is required but not present: 2202 // ./incomplete.cue:20:6 2203 // ./incomplete.cue:20:48 2204 bar: (int){ 2 } 2205 } 2206 } 2207 incomplete5: (struct){ 2208 x: (_|_){ 2209 // [incomplete] incomplete.incomplete5.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected >1 & <=3: 2210 // ./incomplete.cue:24:6 2211 // ./incomplete.cue:24:13 2212 // ./incomplete.cue:25:6 2213 // incomplete.incomplete5.x.baz: field is required but not present: 2214 // ./incomplete.cue:24:6 2215 // ./incomplete.cue:24:51 2216 // incomplete.incomplete5.x.foo: field is required but not present: 2217 // ./incomplete.cue:24:6 2218 // ./incomplete.cue:24:38 2219 bar: (int){ 2 } 2220 } 2221 } 2222 incomplete6: (struct){ 2223 x: (_|_){ 2224 // [incomplete] incomplete.incomplete6.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected 2 | 3: 2225 // ./incomplete.cue:28:6 2226 // ./incomplete.cue:28:13 2227 // ./incomplete.cue:29:6 2228 // incomplete.incomplete6.x.baz: field is required but not present: 2229 // ./incomplete.cue:28:6 2230 // ./incomplete.cue:28:46 2231 // incomplete.incomplete6.x.foo: field is required but not present: 2232 // ./incomplete.cue:28:6 2233 // ./incomplete.cue:28:33 2234 bar: (int){ 2 } 2235 } 2236 } 2237 err1: (_|_){ 2238 // [eval] 2239 x: (_|_){ 2240 // [eval] incomplete.err1.x.bar: conflicting values 2 and string (mismatched types int and string): 2241 // ./incomplete.cue:34:24 2242 // ./incomplete.cue:35:11 2243 // incomplete.err1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 2244 // ./incomplete.cue:34:6 2245 // ./incomplete.cue:34:13 2246 // ./incomplete.cue:35:6 2247 bar: (int){ 2 } 2248 } 2249 } 2250 err2: (_|_){ 2251 // [eval] 2252 x: (_|_){ 2253 // [eval] incomplete.err2.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected 0: 2254 // ./incomplete.cue:40:6 2255 // ./incomplete.cue:40:13 2256 // ./incomplete.cue:41:6 2257 bar: (int){ 2 } 2258 } 2259 } 2260 err3: (_|_){ 2261 // [eval] 2262 x: (_|_){ 2263 // [eval] incomplete.err3.x.bar: conflicting values 2 and string (mismatched types int and string): 2264 // ./incomplete.cue:46:24 2265 // ./incomplete.cue:47:11 2266 // incomplete.err3.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 2: 2267 // ./incomplete.cue:46:6 2268 // ./incomplete.cue:46:13 2269 // ./incomplete.cue:47:6 2270 bar: (int){ 2 } 2271 } 2272 } 2273 err4: (_|_){ 2274 // [eval] 2275 x: (_|_){ 2276 // [eval] incomplete.err4.x.bar: conflicting values 2 and string (mismatched types int and string): 2277 // ./incomplete.cue:51:25 2278 // ./incomplete.cue:52:11 2279 // incomplete.err4.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected >1: 2280 // ./incomplete.cue:51:6 2281 // ./incomplete.cue:51:13 2282 // ./incomplete.cue:52:6 2283 bar: (int){ 2 } 2284 } 2285 } 2286 err5: (_|_){ 2287 // [eval] 2288 x: (_|_){ 2289 // [eval] incomplete.err5.x: invalid value {bar:2} (does not satisfy matchN): 1 matched, expected <1: 2290 // ./incomplete.cue:55:6 2291 // ./incomplete.cue:55:13 2292 // ./incomplete.cue:56:6 2293 bar: (int){ 2 } 2294 } 2295 } 2296 } 2297 issue3389: (struct){ 2298 x: (_|_){ 2299 // [incomplete] issue3389.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 2300 // ./incomplete.cue:62:5 2301 // ./incomplete.cue:61:5 2302 // ./incomplete.cue:62:12 2303 // issue3389.x.foo: field is required but not present: 2304 // ./incomplete.cue:62:5 2305 // ./incomplete.cue:62:35 2306 bar: (int){ 2 } 2307 } 2308 } 2309 issue3694: (struct){ 2310 full: (struct){ 2311 #step: (_|_){ 2312 // [incomplete] issue3694.full.#step: invalid value {uses?:string,run?:string} (does not satisfy matchN): 0 matched, expected 1: 2313 // ./issue3694.cue:2:9 2314 // ./issue3694.cue:2:16 2315 // ./issue3694.cue:9:9 2316 // issue3694.full.#step.run: field is required but not present: 2317 // ./issue3694.cue:2:9 2318 // ./issue3694.cue:6:3 2319 // issue3694.full.#step.uses: field is required but not present: 2320 // ./issue3694.cue:2:9 2321 // ./issue3694.cue:3:3 2322 uses?: (string){ string } 2323 run?: (string){ string } 2324 } 2325 s: (#struct){ 2326 run: (string){ "echo hello world" } 2327 uses?: (string){ string } 2328 } 2329 } 2330 simple: (struct){ 2331 #step: (_|_){ 2332 // [incomplete] issue3694.simple.#step: invalid value {uses?:string} (does not satisfy matchN): 0 matched, expected 1: 2333 // ./issue3694.cue:19:9 2334 // ./issue3694.cue:19:16 2335 // ./issue3694.cue:22:9 2336 // issue3694.simple.#step.uses: field is required but not present: 2337 // ./issue3694.cue:19:9 2338 // ./issue3694.cue:20:3 2339 uses?: (string){ string } 2340 } 2341 } 2342 } 2343 } 2344 -- diff/-out/evalalpha<==>+out/eval -- 2345 diff old new 2346 --- old 2347 +++ new 2348 @@ -2,26 +2,16 @@ 2349 closedByDefinition.err5.out.exports: conflicting values null and {exp1:"./main-module.js"} (mismatched types null and struct): 2350 ./closedness.cue:80:13 2351 ./closedness.cue:80:24 2352 - ./closedness.cue:85:7 2353 ./closedness.cue:86:12 2354 closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and null (mismatched types string and null): 2355 - ./closedness.cue:80:30 2356 ./closedness.cue:81:24 2357 - ./closedness.cue:82:26 2358 - ./closedness.cue:85:7 2359 ./closedness.cue:86:18 2360 closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and {exp1?:#exports} (mismatched types string and struct): 2361 - ./closedness.cue:80:30 2362 - ./closedness.cue:81:30 2363 ./closedness.cue:82:19 2364 - ./closedness.cue:82:26 2365 - ./closedness.cue:85:7 2366 ./closedness.cue:86:18 2367 explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 2368 - ./closedness.cue:32:12 2369 ./closedness.cue:33:6 2370 ./closedness.cue:33:17 2371 - ./closedness.cue:35:7 2372 ./closedness.cue:36:6 2373 incomplete.err1.x.bar: conflicting values 2 and string (mismatched types int and string): 2374 ./incomplete.cue:34:24 2375 @@ -33,24 +23,17 @@ 2376 ./incomplete.cue:51:25 2377 ./incomplete.cue:52:11 2378 match.defaults.pickNested1Err.a: conflicting values 2 and 3: 2379 - ./in.cue:36:23 2380 ./in.cue:36:38 2381 ./in.cue:39:23 2382 match.incompleteErr.a: conflicting values string and int (mismatched types string and int): 2383 ./in.cue:4:5 2384 - ./in.cue:12:21 2385 - ./in.cue:12:32 2386 ./in.cue:14:20 2387 match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): 2388 ./in.cue:4:5 2389 - ./in.cue:8:17 2390 - ./in.cue:8:28 2391 ./in.cue:10:16 2392 openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 2393 - ./closedness.cue:20:12 2394 ./closedness.cue:21:13 2395 ./closedness.cue:22:5 2396 - ./closedness.cue:27:7 2397 ./closedness.cue:28:6 2398 openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 2399 ./closedness.cue:21:13 2400 @@ -62,10 +45,6 @@ 2401 ./closedness.cue:36:6 2402 explicitClose.err1.out.a.baz: field not allowed: 2403 ./closedness.cue:33:6 2404 - ./closedness.cue:32:12 2405 - ./closedness.cue:33:24 2406 - ./closedness.cue:33:30 2407 - ./closedness.cue:35:7 2408 ./closedness.cue:36:11 2409 closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 2410 ./closedness.cue:80:13 2411 @@ -167,17 +146,6 @@ 2412 ./in.cue:106:20 2413 ./in.cue:106:67 2414 ./in.cue:109:17 2415 -issue3575.test1.x: invalid value [{a:1}] (does not satisfy matchN): 0 matched, expected 1: 2416 - ./in.cue:153:7 2417 - ./in.cue:153:14 2418 - ./in.cue:156:6 2419 - ./in.cue:157:6 2420 -issue3575.test1.x.0.a: field not allowed: 2421 - ./in.cue:153:7 2422 - ./in.cue:154:4 2423 - ./in.cue:154:5 2424 - ./in.cue:156:6 2425 - ./in.cue:157:8 2426 incomplete.err1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 2427 ./incomplete.cue:34:6 2428 ./incomplete.cue:34:13 2429 @@ -205,7 +173,7 @@ 2430 ellipsis: (struct){ 2431 ok: (struct){ 2432 out: (#struct){ 2433 - field: (struct){ 2434 + field: (#struct){ 2435 shouldBeAllowed: (int){ 123 } 2436 } 2437 #anything: (_){ matchN(1, (#list){ 2438 @@ -245,7 +213,7 @@ 2439 }) } 2440 } 2441 out: (#struct){ 2442 - a: (struct){ 2443 + a: (#struct){ 2444 baz: (string){ "allowed" } 2445 } 2446 } 2447 @@ -272,10 +240,8 @@ 2448 // [eval] 2449 a: (_|_){ 2450 // [eval] openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 2451 - // ./closedness.cue:20:12 2452 // ./closedness.cue:21:13 2453 // ./closedness.cue:22:5 2454 - // ./closedness.cue:27:7 2455 // ./closedness.cue:28:6 2456 // openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 2457 // ./closedness.cue:21:13 2458 @@ -304,10 +270,8 @@ 2459 // [eval] 2460 a: (_|_){ 2461 // [eval] explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 2462 - // ./closedness.cue:32:12 2463 // ./closedness.cue:33:6 2464 // ./closedness.cue:33:17 2465 - // ./closedness.cue:35:7 2466 // ./closedness.cue:36:6 2467 // explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 2468 // ./closedness.cue:33:6 2469 @@ -315,10 +279,6 @@ 2470 // ./closedness.cue:36:6 2471 // explicitClose.err1.out.a.baz: field not allowed: 2472 // ./closedness.cue:33:6 2473 - // ./closedness.cue:32:12 2474 - // ./closedness.cue:33:24 2475 - // ./closedness.cue:33:30 2476 - // ./closedness.cue:35:7 2477 // ./closedness.cue:36:11 2478 baz: (string){ "notAllowed" } 2479 } 2480 @@ -342,7 +302,7 @@ 2481 }) } 2482 } 2483 out: (#struct){ 2484 - a: (struct){ 2485 + a: (#struct){ 2486 allowed: (string){ "once" } 2487 } 2488 } 2489 @@ -375,7 +335,7 @@ 2490 } 2491 } 2492 out: (#struct){ 2493 - exports: (struct){ 2494 + exports: (#struct){ 2495 exp1: (string){ "./main-module.js" } 2496 } 2497 #exports: (_){ matchN(1, (#list){ 2498 @@ -421,7 +381,7 @@ 2499 } 2500 } 2501 out: (#struct){ 2502 - exports: (struct){ 2503 + exports: (#struct){ 2504 exp1: (string){ "./main-module.js" } 2505 } 2506 #exports: (_){ matchN(1, (#list){ 2507 @@ -470,20 +430,12 @@ 2508 // [eval] closedByDefinition.err5.out.exports: conflicting values null and {exp1:"./main-module.js"} (mismatched types null and struct): 2509 // ./closedness.cue:80:13 2510 // ./closedness.cue:80:24 2511 - // ./closedness.cue:85:7 2512 // ./closedness.cue:86:12 2513 // closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and null (mismatched types string and null): 2514 - // ./closedness.cue:80:30 2515 // ./closedness.cue:81:24 2516 - // ./closedness.cue:82:26 2517 - // ./closedness.cue:85:7 2518 // ./closedness.cue:86:18 2519 // closedByDefinition.err5.out.exports.exp1: conflicting values "./main-module.js" and {exp1?:#exports} (mismatched types string and struct): 2520 - // ./closedness.cue:80:30 2521 - // ./closedness.cue:81:30 2522 // ./closedness.cue:82:19 2523 - // ./closedness.cue:82:26 2524 - // ./closedness.cue:85:7 2525 // ./closedness.cue:86:18 2526 // closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 2527 // ./closedness.cue:80:13 2528 @@ -524,8 +476,6 @@ 2529 singleErr: (_|_){ 2530 // [eval] match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): 2531 // ./in.cue:4:5 2532 - // ./in.cue:8:17 2533 - // ./in.cue:8:28 2534 // ./in.cue:10:16 2535 // match.singleErr: invalid value {a:"foo"} (does not satisfy matchN): 0 matched, expected 1: 2536 // ./in.cue:8:17 2537 @@ -539,8 +489,6 @@ 2538 incompleteErr: (_|_){ 2539 // [eval] match.incompleteErr.a: conflicting values string and int (mismatched types string and int): 2540 // ./in.cue:4:5 2541 - // ./in.cue:12:21 2542 - // ./in.cue:12:32 2543 // ./in.cue:14:20 2544 // match.incompleteErr: invalid value {a:string} (does not satisfy matchN): 0 matched, expected 1: 2545 // ./in.cue:12:21 2546 @@ -572,7 +520,6 @@ 2547 } 2548 pickNested1Err: (_|_){ 2549 // [eval] match.defaults.pickNested1Err.a: conflicting values 2 and 3: 2550 - // ./in.cue:36:23 2551 // ./in.cue:36:38 2552 // ./in.cue:39:23 2553 // match.defaults.pickNested1Err: invalid value {a:*3 | int} (does not satisfy matchN): 0 matched, expected 1: 2554 @@ -800,10 +747,8 @@ 2555 } 2556 } 2557 } 2558 - issue3575: (_|_){ 2559 - // [eval] 2560 - test1: (_|_){ 2561 - // [eval] 2562 + issue3575: (struct){ 2563 + test1: (struct){ 2564 #x: (_){ matchN(1, (#list){ 2565 0: (_|_){// [ 2566 // {}, 2567 @@ -810,18 +755,7 @@ 2568 // ] 2569 } 2570 }) } 2571 - x: (_|_){ 2572 - // [eval] issue3575.test1.x: invalid value [{a:1}] (does not satisfy matchN): 0 matched, expected 1: 2573 - // ./in.cue:153:7 2574 - // ./in.cue:153:14 2575 - // ./in.cue:156:6 2576 - // ./in.cue:157:6 2577 - // issue3575.test1.x.0.a: field not allowed: 2578 - // ./in.cue:153:7 2579 - // ./in.cue:154:4 2580 - // ./in.cue:154:5 2581 - // ./in.cue:156:6 2582 - // ./in.cue:157:8 2583 + x: (#list){ 2584 0: (struct){ 2585 a: (int){ 1 } 2586 } 2587 @@ -832,7 +766,7 @@ 2588 0: (_|_){// {} 2589 } 2590 }) } 2591 - x: (struct){ 2592 + x: (#struct){ 2593 a: (int){ 1 } 2594 } 2595 } 2596 @@ -1005,8 +939,8 @@ 2597 run?: (string){ string } 2598 } 2599 s: (#struct){ 2600 - uses?: (string){ string } 2601 run: (string){ "echo hello world" } 2602 + uses?: (string){ string } 2603 } 2604 } 2605 simple: (struct){ 2606 -- diff/explanation -- 2607 The old evaluator does not correctly handle ToDataAll if a node is 2608 mid-evaluation. The new evaluator does. 2609 issue3575: the old evaluator was incorrect in behaving differently when using structs inside lists 2610 closedness.cue: several discrepancies. EvalV3 is correct in all cases. 2611 -- diff/todo/p3 -- 2612 Missing error positions. 2613 -- out/compile -- 2614 --- closedness.cue 2615 { 2616 ellipsis: { 2617 ok: { 2618 out: (〈0;#Schema〉 & { 2619 field: { 2620 shouldBeAllowed: 123 2621 } 2622 }) 2623 #Schema: { 2624 field?: 〈0;#anything〉 2625 #anything: matchN(1, [ 2626 { 2627 ... 2628 }, 2629 ]) 2630 } 2631 } 2632 } 2633 openArguments: { 2634 ok1: { 2635 #Schema: { 2636 { 2637 a: matchN(1, [ 2638 "all", 2639 { 2640 foo: "bar" 2641 }, 2642 ]) 2643 } 2644 } 2645 out: (〈0;#Schema〉 & { 2646 a: { 2647 baz: "allowed" 2648 } 2649 }) 2650 } 2651 } 2652 openArguments: { 2653 err2: { 2654 #Schema: { 2655 { 2656 a?: matchN(1, [ 2657 null, 2658 { 2659 [string]: string 2660 }, 2661 { 2662 b: { 2663 ... 2664 } 2665 }, 2666 ]) 2667 } 2668 } 2669 out: (〈0;#Schema〉 & { 2670 a: { 2671 allowed: "once" 2672 } 2673 }) 2674 } 2675 } 2676 explicitClose: { 2677 err1: { 2678 #Schema: { 2679 { 2680 a: matchN(1, [ 2681 "all", 2682 close({ 2683 foo: "bar" 2684 }), 2685 ]) 2686 } 2687 } 2688 out: (〈0;#Schema〉 & { 2689 a: { 2690 baz: "notAllowed" 2691 } 2692 }) 2693 } 2694 } 2695 explicitClose: { 2696 ok2: { 2697 #Schema: { 2698 { 2699 a?: matchN(1, [ 2700 null, 2701 close({ 2702 [string]: string 2703 }), 2704 close({ 2705 b: { 2706 ... 2707 } 2708 }), 2709 ]) 2710 } 2711 } 2712 out: (〈0;#Schema〉 & { 2713 a: { 2714 allowed: "once" 2715 } 2716 }) 2717 } 2718 } 2719 mixed: { 2720 ok3: { 2721 #Schema: { 2722 exports?: matchN(1, [ 2723 close({ 2724 never?: _ 2725 }), 2726 〈1;#exportsObject〉, 2727 ]) 2728 #exports: matchN(1, [ 2729 string, 2730 〈1;#exportsObject〉, 2731 ]) 2732 #exportsObject: { 2733 exp1?: 〈1;#exports〉 2734 } 2735 } 2736 out: (〈0;#Schema〉 & { 2737 exports: { 2738 exp1: "./main-module.js" 2739 } 2740 }) 2741 } 2742 } 2743 closedByDefinition: { 2744 ok4: { 2745 #Schema: { 2746 exports?: matchN(1, [ 2747 string, 2748 〈1;#exportsObject〉, 2749 ]) 2750 #exports: matchN(1, [ 2751 string, 2752 〈1;#exportsObject〉, 2753 ]) 2754 #exportsObject: { 2755 exp1?: 〈1;#exports〉 2756 } 2757 } 2758 out: (〈0;#Schema〉 & { 2759 exports: { 2760 exp1: "./main-module.js" 2761 } 2762 }) 2763 } 2764 } 2765 closedByDefinition: { 2766 err5: { 2767 #Schema: { 2768 exports?: matchN(1, [ 2769 null, 2770 〈1;#exportsObject〉, 2771 ]) 2772 #exports: matchN(1, [ 2773 null, 2774 〈1;#exportsObject〉, 2775 ]) 2776 #exportsObject: { 2777 exp1?: 〈1;#exports〉 2778 } 2779 } 2780 out: (〈0;#Schema〉 & { 2781 exports: { 2782 exp1: "./main-module.js" 2783 } 2784 }) 2785 } 2786 } 2787 } 2788 --- in.cue 2789 { 2790 #Foo: { 2791 a: int 2792 } 2793 match: { 2794 [=~"^single"]: matchN(1, [ 2795 〈2;#Foo〉, 2796 ]) 2797 singleOK: { 2798 a: 2 2799 } 2800 singleErr: { 2801 a: "foo" 2802 } 2803 [=~"^incomplete"]: matchN(1, [ 2804 〈2;#Foo〉, 2805 ]) 2806 incompleteOK: { 2807 a: int 2808 } 2809 incompleteErr: { 2810 a: string 2811 } 2812 #A: { 2813 a: int 2814 b: _ 2815 ... 2816 } 2817 defaults: { 2818 [=~"^pickTop"]: matchN(1, [ 2819 2, 2820 ]) 2821 pickTopOK1: (*2|int) 2822 pickTopOK2: int 2823 pickTopErr: (*3|int) 2824 [=~"^pickNested1"]: matchN(1, [ 2825 { 2826 a: 2 2827 }, 2828 ]) 2829 pickNested1OK1: { 2830 a: (*2|int) 2831 } 2832 pickNested1OK2: { 2833 a: int 2834 } 2835 pickNested1Err: { 2836 a: (*3|int) 2837 } 2838 [=~"^pickNested2"]: matchN(1, [ 2839 { 2840 a: <=2 2841 }, 2842 ]) 2843 pickNested2OK1: { 2844 a: (*2|int) 2845 } 2846 pickNested2OK2: { 2847 a: int 2848 } 2849 pickNested2Err: { 2850 a: (*3|int) 2851 } 2852 } 2853 nestedOK: { 2854 matchN(4, [ 2855 〈2;#A〉, 2856 〈2;#A〉, 2857 〈2;#A〉, 2858 〈2;#A〉, 2859 ]) 2860 a: 2 2861 b: { 2862 matchN(4, [ 2863 〈3;#A〉, 2864 〈3;#A〉, 2865 〈3;#A〉, 2866 〈3;#A〉, 2867 ]) 2868 a: 3 2869 b: matchN(4, [ 2870 〈3;#A〉, 2871 〈3;#A〉, 2872 〈3;#A〉, 2873 〈3;#A〉, 2874 ]) 2875 b: { 2876 a: 4 2877 } 2878 c: matchN(4, [ 2879 〈3;#A〉, 2880 〈3;#A〉, 2881 〈3;#A〉, 2882 〈3;#A〉, 2883 ]) 2884 c: { 2885 a: 5 2886 } 2887 } 2888 c: { 2889 matchN(4, [ 2890 〈3;#A〉, 2891 〈3;#A〉, 2892 〈3;#A〉, 2893 〈3;#A〉, 2894 ]) 2895 a: 3 2896 b: matchN(4, [ 2897 〈3;#A〉, 2898 〈3;#A〉, 2899 〈3;#A〉, 2900 〈3;#A〉, 2901 ]) 2902 b: { 2903 a: 4 2904 } 2905 c: matchN(4, [ 2906 〈3;#A〉, 2907 〈3;#A〉, 2908 〈3;#A〉, 2909 〈3;#A〉, 2910 ]) 2911 c: { 2912 a: 5 2913 } 2914 } 2915 } 2916 } 2917 not: { 2918 [=~"^single"]: matchN(0, [ 2919 〈2;#Foo〉, 2920 ]) 2921 singleOK: { 2922 a: "foo" 2923 } 2924 singleErr: { 2925 a: 2 2926 } 2927 [=~"^double"]: matchN(0, [ 2928 matchN(0, [ 2929 〈3;#Foo〉, 2930 ]), 2931 ]) 2932 doubleOK: { 2933 a: 2 2934 } 2935 doubleErr: { 2936 a: "foo" 2937 } 2938 } 2939 oneOf: { 2940 [=~"^multiple1"]: matchN(1, [ 2941 〈import;math〉.MultipleOf(3), 2942 〈import;math〉.MultipleOf(5), 2943 ]) 2944 multiple1Err1: 1 2945 multiple1OK1: 3 2946 multiple1OK2: 5 2947 multiple1Err2: 15 2948 } 2949 anyOf: { 2950 [=~"^multiple1"]: matchN(>0, [ 2951 〈import;math〉.MultipleOf(3), 2952 〈import;math〉.MultipleOf(5), 2953 ]) 2954 multiple1Err1: 1 2955 multiple1OK1: 3 2956 multiple1OK2: 5 2957 multiple1OK3: 15 2958 } 2959 allOf: { 2960 [=~"^multiple1"]: matchN(2, [ 2961 〈import;math〉.MultipleOf(3), 2962 〈import;math〉.MultipleOf(5), 2963 ]) 2964 multiple1Err1: 1 2965 multiple1Err2: 3 2966 multiple1Err3: 5 2967 multiple1OK1: 15 2968 } 2969 bare: { 2970 embed: { 2971 t1: { 2972 a: { 2973 matchN(1, [ 2974 >10, 2975 ]) 2976 } 2977 b: { 2978 〈1;a〉 2979 } 2980 } 2981 } 2982 embed: { 2983 t2: { 2984 b: { 2985 〈1;a〉 2986 } 2987 a: { 2988 matchN(1, [ 2989 >10, 2990 ]) 2991 } 2992 } 2993 } 2994 direct: { 2995 t1: { 2996 a: matchN(1, [ 2997 >10, 2998 ]) 2999 b: 〈0;a〉 3000 } 3001 } 3002 direct: { 3003 t2: { 3004 b: 〈0;a〉 3005 a: matchN(1, [ 3006 >10, 3007 ]) 3008 } 3009 } 3010 } 3011 required: { 3012 ok1: { 3013 x: matchN(0, [ 3014 { 3015 foo!: string 3016 }, 3017 ]) 3018 x: { 3019 bar: 2 3020 } 3021 } 3022 ok2: { 3023 x: matchN(0, [ 3024 { 3025 foo!: string 3026 }, 3027 ]) 3028 } 3029 ok3: { 3030 x: matchN(0, [ 3031 { 3032 bar!: string 3033 }, 3034 ]) 3035 x: { 3036 bar: 2 3037 } 3038 } 3039 } 3040 issue3575: { 3041 test1: { 3042 #x: matchN(1, [ 3043 [ 3044 {}, 3045 ], 3046 ]) 3047 x: 〈0;#x〉 3048 x: [ 3049 { 3050 a: 1 3051 }, 3052 ] 3053 } 3054 test2: { 3055 #x: matchN(1, [ 3056 {}, 3057 ]) 3058 x: 〈0;#x〉 3059 x: { 3060 a: 1 3061 } 3062 } 3063 } 3064 } 3065 --- incomplete.cue 3066 { 3067 incomplete: { 3068 incomplete1: { 3069 x: matchN(1, [ 3070 { 3071 foo!: string 3072 }, 3073 ]) 3074 x: { 3075 bar: 2 3076 } 3077 } 3078 incomplete2: { 3079 x: matchN(1, [ 3080 { 3081 foo!: string 3082 }, 3083 ]) 3084 } 3085 incomplete3: { 3086 x: matchN(〈import;math〉.MultipleOf(2), [ 3087 { 3088 bar!: int 3089 }, 3090 { 3091 foo!: int 3092 }, 3093 ]) 3094 x: { 3095 bar: 2 3096 } 3097 } 3098 incomplete4: { 3099 x: matchN(〈import;math〉.MultipleOf(2), [ 3100 { 3101 bar!: int 3102 }, 3103 { 3104 foo!: int 3105 }, 3106 { 3107 baz!: int 3108 }, 3109 ]) 3110 x: { 3111 bar: 2 3112 } 3113 } 3114 incomplete5: { 3115 x: matchN((>1 & <=3), [ 3116 { 3117 bar!: int 3118 }, 3119 { 3120 foo!: int 3121 }, 3122 { 3123 baz!: int 3124 }, 3125 ]) 3126 x: { 3127 bar: 2 3128 } 3129 } 3130 incomplete6: { 3131 x: matchN((2|3), [ 3132 { 3133 bar!: int 3134 }, 3135 { 3136 foo!: int 3137 }, 3138 { 3139 baz!: int 3140 }, 3141 ]) 3142 x: { 3143 bar: 2 3144 } 3145 } 3146 err1: { 3147 x: matchN(1, [ 3148 { 3149 bar!: string 3150 }, 3151 ]) 3152 x: { 3153 bar: 2 3154 } 3155 } 3156 err2: { 3157 x: matchN(0, [ 3158 { 3159 bar!: int 3160 }, 3161 { 3162 foo!: int 3163 }, 3164 ]) 3165 x: { 3166 bar: 2 3167 } 3168 } 3169 err3: { 3170 x: matchN(2, [ 3171 { 3172 bar!: string 3173 }, 3174 { 3175 foo!: string 3176 }, 3177 ]) 3178 x: { 3179 bar: 2 3180 } 3181 } 3182 err4: { 3183 x: matchN(>1, [ 3184 { 3185 bar!: string 3186 }, 3187 { 3188 foo!: string 3189 }, 3190 ]) 3191 x: { 3192 bar: 2 3193 } 3194 } 3195 err5: { 3196 x: matchN(<1, [ 3197 { 3198 bar!: int 3199 }, 3200 { 3201 foo!: int 3202 }, 3203 ]) 3204 x: { 3205 bar: 2 3206 } 3207 } 3208 } 3209 issue3389: { 3210 x: { 3211 bar: 2 3212 } 3213 x: matchN(1, [ 3214 { 3215 bar: 3 3216 }, 3217 { 3218 bar: 2 3219 foo!: int 3220 }, 3221 ]) 3222 } 3223 } 3224 --- issue3694.cue 3225 { 3226 issue3694: { 3227 full: { 3228 #step: matchN(1, [ 3229 { 3230 uses!: _ 3231 ... 3232 }, 3233 { 3234 run!: _ 3235 ... 3236 }, 3237 ]) 3238 #step: close({ 3239 uses?: string 3240 run?: string 3241 }) 3242 s: (〈0;#step〉 & { 3243 run: "echo hello world" 3244 }) 3245 } 3246 } 3247 issue3694: { 3248 simple: { 3249 #step: matchN(1, [ 3250 { 3251 uses!: _ 3252 }, 3253 ]) 3254 #step: close({ 3255 uses?: string 3256 }) 3257 } 3258 } 3259 }