this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: arguments are not closed in definitions

evalv3 introduced a regression where literal structs
passed to validators contained within a definition
were treated as closed.

This fixes that and brings it in line with V2.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I9c1aa8374d3caae006a90073e70e4633b14fa757
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211385
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Matthew Sackman <matthew@cue.works>

+162 -373
+2 -2
cue/testdata/benchmarks/issue3514.txtar
··· 43 43 Retain: 0 44 44 45 45 Unifications: 1256 46 - Conjuncts: 10226 46 + Conjuncts: 9655 47 47 Disjuncts: 2386 48 48 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 49 49 diff old new ··· 65 65 -Conjuncts: 92950 66 66 -Disjuncts: 31139 67 67 +Unifications: 1256 68 - +Conjuncts: 10226 68 + +Conjuncts: 9655 69 69 +Disjuncts: 2386 70 70 -- out/eval/stats -- 71 71 Leaks: 27
+2 -2
cue/testdata/builtins/closed.txtar
··· 64 64 Retain: 0 65 65 66 66 Unifications: 179 67 - Conjuncts: 607 67 + Conjuncts: 595 68 68 Disjuncts: 24 69 69 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 70 70 diff old new ··· 86 86 -Conjuncts: 389 87 87 -Disjuncts: 204 88 88 +Unifications: 179 89 - +Conjuncts: 607 89 + +Conjuncts: 595 90 90 +Disjuncts: 24 91 91 -- out/eval/stats -- 92 92 Leaks: 43
+2 -2
cue/testdata/builtins/incomplete.txtar
··· 108 108 Retain: 0 109 109 110 110 Unifications: 79 111 - Conjuncts: 114 111 + Conjuncts: 112 112 112 Disjuncts: 4 113 113 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 114 114 diff old new ··· 130 130 -Conjuncts: 255 131 131 -Disjuncts: 150 132 132 +Unifications: 79 133 - +Conjuncts: 114 133 + +Conjuncts: 112 134 134 +Disjuncts: 4 135 135 -- out/eval/stats -- 136 136 Leaks: 8
+131 -258
cue/testdata/builtins/matchn.txtar
··· 1415 1415 match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): 1416 1416 ./in.cue:4:5 1417 1417 ./in.cue:10:16 1418 - openArguments.ok1.out.a: conflicting values "all" and {baz:"allowed"} (mismatched types string and struct): 1419 - ./closedness.cue:13:6 1420 - ./closedness.cue:13:17 1421 - ./closedness.cue:16:6 1422 - openArguments.ok1.out.a: invalid value {baz:"allowed"} (does not satisfy matchN): 0 matched, expected 1: 1423 - ./closedness.cue:13:6 1424 - ./closedness.cue:13:13 1425 - ./closedness.cue:16:6 1426 - openArguments.ok1.out.a.baz: field not allowed: 1427 - ./closedness.cue:13:6 1428 - ./closedness.cue:16:11 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 + openArguments.err2.out.a: cannot combine regular field "allowed" with null: 1427 + ./closedness.cue:28:15 1428 + ./closedness.cue:22:5 1429 1429 explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 1430 1430 ./closedness.cue:33:6 1431 1431 ./closedness.cue:33:13 1432 1432 ./closedness.cue:36:6 1433 1433 explicitClose.err1.out.a.baz: field not allowed: 1434 - ./closedness.cue:33:6 1434 + ./closedness.cue:33:24 1435 1435 ./closedness.cue:36:11 1436 - explicitClose.err1.out.a.baz: field not allowed: 1437 - ./closedness.cue:33:24 1436 + explicitClose.err1.out.a: cannot combine regular field "baz" with "all": 1438 1437 ./closedness.cue:36:11 1438 + ./closedness.cue:33:17 1439 1439 closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 1440 1440 ./closedness.cue:80:13 1441 1441 ./closedness.cue:80:20 1442 1442 ./closedness.cue:86:12 1443 - closedByDefinition.err5.out.exports.exp1: field not allowed: 1444 - ./closedness.cue:80:13 1445 - ./closedness.cue:86:18 1446 1443 closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 1447 1444 ./closedness.cue:81:13 1448 1445 ./closedness.cue:81:20 1449 1446 ./closedness.cue:82:26 1450 1447 ./closedness.cue:86:18 1448 + closedByDefinition.err5.out.exports: cannot combine regular field "exp1" with null: 1449 + ./closedness.cue:86:18 1450 + ./closedness.cue:80:24 1451 1451 match.singleErr: invalid value {a:"foo"} (does not satisfy matchN): 0 matched, expected 1: 1452 1452 ./in.cue:8:17 1453 1453 ./in.cue:8:24 ··· 1570 1570 shouldBeAllowed: (int){ 123 } 1571 1571 } 1572 1572 #anything: (_){ matchN(1, (#list){ 1573 - 0: (_|_){// [d]&[{ 1573 + 0: (_|_){// { 1574 1574 // ... 1575 - // }] 1575 + // } 1576 1576 } 1577 1577 }) } 1578 1578 } ··· 1594 1594 } 1595 1595 openArguments: (_|_){ 1596 1596 // [eval] 1597 - ok1: (_|_){ 1598 - // [eval] 1597 + ok1: (struct){ 1599 1598 #Schema: (#struct){ 1600 1599 a: (_){ matchN(1, (#list){ 1601 1600 0: (_|_){// "all" ··· 1606 1605 } 1607 1606 }) } 1608 1607 } 1609 - out: (_|_){ 1610 - // [eval] 1611 - a: (_|_){ 1612 - // [eval] openArguments.ok1.out.a: conflicting values "all" and {baz:"allowed"} (mismatched types string and struct): 1613 - // ./closedness.cue:13:6 1614 - // ./closedness.cue:13:17 1615 - // ./closedness.cue:16:6 1616 - // openArguments.ok1.out.a: invalid value {baz:"allowed"} (does not satisfy matchN): 0 matched, expected 1: 1617 - // ./closedness.cue:13:6 1618 - // ./closedness.cue:13:13 1619 - // ./closedness.cue:16:6 1620 - // openArguments.ok1.out.a.baz: field not allowed: 1621 - // ./closedness.cue:13:6 1622 - // ./closedness.cue:16:11 1608 + out: (#struct){ 1609 + a: (#struct){ 1623 1610 baz: (string){ "allowed" } 1624 1611 } 1625 1612 } 1626 1613 } 1627 - err2: (struct){ 1614 + err2: (_|_){ 1615 + // [eval] 1628 1616 #Schema: (#struct){ 1629 1617 a?: (_){ matchN(1, (#list){ 1630 1618 0: (_|_){// null ··· 1641 1629 } 1642 1630 }) } 1643 1631 } 1644 - out: (#struct){ 1645 - a: (#struct){ 1632 + out: (_|_){ 1633 + // [eval] 1634 + a: (_|_){ 1635 + // [eval] openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 1636 + // ./closedness.cue:21:13 1637 + // ./closedness.cue:22:5 1638 + // ./closedness.cue:28:6 1639 + // openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 1640 + // ./closedness.cue:21:13 1641 + // ./closedness.cue:21:20 1642 + // ./closedness.cue:28:6 1643 + // openArguments.err2.out.a: cannot combine regular field "allowed" with null: 1644 + // ./closedness.cue:28:15 1645 + // ./closedness.cue:22:5 1646 1646 allowed: (string){ "once" } 1647 1647 } 1648 1648 } ··· 1674 1674 // ./closedness.cue:33:13 1675 1675 // ./closedness.cue:36:6 1676 1676 // explicitClose.err1.out.a.baz: field not allowed: 1677 - // ./closedness.cue:33:6 1678 - // ./closedness.cue:36:11 1679 - // explicitClose.err1.out.a.baz: field not allowed: 1680 1677 // ./closedness.cue:33:24 1681 1678 // ./closedness.cue:36:11 1679 + // explicitClose.err1.out.a: cannot combine regular field "baz" with "all": 1680 + // ./closedness.cue:36:11 1681 + // ./closedness.cue:33:17 1682 1682 baz: (string){ "notAllowed" } 1683 1683 } 1684 1684 } ··· 1738 1738 exp1: (string){ "./main-module.js" } 1739 1739 } 1740 1740 #exports: (_){ matchN(1, (#list){ 1741 - 0: (_|_){// [d]&[string] 1741 + 0: (_|_){// string 1742 1742 } 1743 - 1: (_|_){// [d]&[〈1;#exportsObject〉] 1743 + 1: (_|_){// 〈1;#exportsObject〉 1744 1744 } 1745 1745 }) } 1746 1746 #exportsObject: (#struct){ 1747 1747 exp1?: (_){ matchN(1, (#list){ 1748 - 0: (_|_){// [d]&[string] 1748 + 0: (_|_){// string 1749 1749 } 1750 - 1: (_|_){// [d]&[〈1;#exportsObject〉] 1750 + 1: (_|_){// 〈1;#exportsObject〉 1751 1751 } 1752 1752 }) } 1753 1753 } ··· 1784 1784 exp1: (string){ "./main-module.js" } 1785 1785 } 1786 1786 #exports: (_){ matchN(1, (#list){ 1787 - 0: (_|_){// [d]&[string] 1787 + 0: (_|_){// string 1788 1788 } 1789 - 1: (_|_){// [d]&[〈1;#exportsObject〉] 1789 + 1: (_|_){// 〈1;#exportsObject〉 1790 1790 } 1791 1791 }) } 1792 1792 #exportsObject: (#struct){ 1793 1793 exp1?: (_){ matchN(1, (#list){ 1794 - 0: (_|_){// [d]&[string] 1794 + 0: (_|_){// string 1795 1795 } 1796 - 1: (_|_){// [d]&[〈1;#exportsObject〉] 1796 + 1: (_|_){// 〈1;#exportsObject〉 1797 1797 } 1798 1798 }) } 1799 1799 } ··· 1840 1840 // ./closedness.cue:80:13 1841 1841 // ./closedness.cue:80:20 1842 1842 // ./closedness.cue:86:12 1843 - // closedByDefinition.err5.out.exports.exp1: field not allowed: 1844 - // ./closedness.cue:80:13 1845 - // ./closedness.cue:86:18 1846 1843 // closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 1847 1844 // ./closedness.cue:81:13 1848 1845 // ./closedness.cue:81:20 1849 1846 // ./closedness.cue:82:26 1850 1847 // ./closedness.cue:86:18 1848 + // closedByDefinition.err5.out.exports: cannot combine regular field "exp1" with null: 1849 + // ./closedness.cue:86:18 1850 + // ./closedness.cue:80:24 1851 1851 exp1: (string){ "./main-module.js" } 1852 1852 } 1853 1853 #exports: (_){ matchN(1, (#list){ 1854 - 0: (_|_){// [d]&[null] 1854 + 0: (_|_){// null 1855 1855 } 1856 - 1: (_|_){// [d]&[〈1;#exportsObject〉] 1856 + 1: (_|_){// 〈1;#exportsObject〉 1857 1857 } 1858 1858 }) } 1859 1859 #exportsObject: (#struct){ 1860 1860 exp1?: (_){ matchN(1, (#list){ 1861 - 0: (_|_){// [d]&[null] 1861 + 0: (_|_){// null 1862 1862 } 1863 - 1: (_|_){// [d]&[〈1;#exportsObject〉] 1863 + 1: (_|_){// 〈1;#exportsObject〉 1864 1864 } 1865 1865 }) } 1866 1866 } ··· 2384 2384 ./closedness.cue:86:18 2385 2385 explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 2386 2386 - ./closedness.cue:32:12 2387 - ./closedness.cue:33:6 2388 - ./closedness.cue:33:17 2387 + - ./closedness.cue:33:6 2388 + - ./closedness.cue:33:17 2389 2389 - ./closedness.cue:35:7 2390 + + ./closedness.cue:33:6 2391 + + ./closedness.cue:33:17 2390 2392 ./closedness.cue:36:6 2391 2393 incomplete.err1.x.bar: conflicting values 2 and string (mismatched types int and string): 2392 2394 ./incomplete.cue:34:24 2393 - @@ -33,29 +23,25 @@ 2395 + @@ -33,40 +23,35 @@ 2394 2396 ./incomplete.cue:51:25 2395 2397 ./incomplete.cue:52:11 2396 2398 match.defaults.pickNested1Err.a: conflicting values 2 and 3: ··· 2407 2409 - ./in.cue:8:17 2408 2410 - ./in.cue:8:28 2409 2411 ./in.cue:10:16 2410 - -openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 2412 + openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 2411 2413 - ./closedness.cue:20:12 2412 2414 - ./closedness.cue:21:13 2413 2415 - ./closedness.cue:22:5 2414 2416 - ./closedness.cue:27:7 2415 - - ./closedness.cue:28:6 2416 - -openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 2417 - - ./closedness.cue:21:13 2418 - - ./closedness.cue:21:20 2419 - - ./closedness.cue:28:6 2420 - +openArguments.ok1.out.a: conflicting values "all" and {baz:"allowed"} (mismatched types string and struct): 2421 - + ./closedness.cue:13:6 2422 - + ./closedness.cue:13:17 2423 - + ./closedness.cue:16:6 2424 - +openArguments.ok1.out.a: invalid value {baz:"allowed"} (does not satisfy matchN): 0 matched, expected 1: 2425 - + ./closedness.cue:13:6 2426 - + ./closedness.cue:13:13 2427 - + ./closedness.cue:16:6 2428 - +openArguments.ok1.out.a.baz: field not allowed: 2429 - + ./closedness.cue:13:6 2430 - + ./closedness.cue:16:11 2417 + + ./closedness.cue:21:13 2418 + + ./closedness.cue:22:5 2419 + ./closedness.cue:28:6 2420 + openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 2421 + ./closedness.cue:21:13 2422 + ./closedness.cue:21:20 2423 + ./closedness.cue:28:6 2424 + +openArguments.err2.out.a: cannot combine regular field "allowed" with null: 2425 + + ./closedness.cue:28:15 2426 + + ./closedness.cue:22:5 2431 2427 explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 2432 2428 ./closedness.cue:33:6 2433 2429 ./closedness.cue:33:13 2434 - @@ -62,15 +48,17 @@ 2435 2430 ./closedness.cue:36:6 2436 2431 explicitClose.err1.out.a.baz: field not allowed: 2437 - ./closedness.cue:33:6 2432 + - ./closedness.cue:33:6 2438 2433 - ./closedness.cue:32:12 2439 - + ./closedness.cue:36:11 2440 - +explicitClose.err1.out.a.baz: field not allowed: 2441 2434 ./closedness.cue:33:24 2442 2435 - ./closedness.cue:33:30 2443 2436 - ./closedness.cue:35:7 2444 - ./closedness.cue:36:11 2437 + - ./closedness.cue:36:11 2438 + + ./closedness.cue:36:11 2439 + +explicitClose.err1.out.a: cannot combine regular field "baz" with "all": 2440 + + ./closedness.cue:36:11 2441 + + ./closedness.cue:33:17 2445 2442 closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 2446 2443 ./closedness.cue:80:13 2447 2444 ./closedness.cue:80:20 2448 - ./closedness.cue:86:12 2449 - +closedByDefinition.err5.out.exports.exp1: field not allowed: 2450 - + ./closedness.cue:80:13 2451 - + ./closedness.cue:86:18 2452 - closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 2453 - ./closedness.cue:81:13 2445 + @@ -76,6 +61,9 @@ 2454 2446 ./closedness.cue:81:20 2447 + ./closedness.cue:82:26 2448 + ./closedness.cue:86:18 2449 + +closedByDefinition.err5.out.exports: cannot combine regular field "exp1" with null: 2450 + + ./closedness.cue:86:18 2451 + + ./closedness.cue:80:24 2452 + match.singleErr: invalid value {a:"foo"} (does not satisfy matchN): 0 matched, expected 1: 2453 + ./in.cue:8:17 2454 + ./in.cue:8:24 2455 2455 @@ -167,17 +155,6 @@ 2456 2456 ./in.cue:106:20 2457 2457 ./in.cue:106:67 ··· 2470 2470 incomplete.err1.x: invalid value {bar:2} (does not satisfy matchN): 0 matched, expected 1: 2471 2471 ./incomplete.cue:34:6 2472 2472 ./incomplete.cue:34:13 2473 - @@ -205,13 +182,13 @@ 2473 + @@ -205,7 +182,7 @@ 2474 2474 ellipsis: (struct){ 2475 2475 ok: (struct){ 2476 2476 out: (#struct){ ··· 2479 2479 shouldBeAllowed: (int){ 123 } 2480 2480 } 2481 2481 #anything: (_){ matchN(1, (#list){ 2482 - - 0: (_|_){// { 2483 - - // ... 2484 - - // } 2485 - + 0: (_|_){// [d]&[{ 2486 - + // ... 2487 - + // }] 2488 - } 2482 + @@ -245,7 +222,7 @@ 2489 2483 }) } 2490 2484 } 2491 - @@ -233,25 +210,37 @@ 2492 - } 2493 - openArguments: (_|_){ 2494 - // [eval] 2495 - - ok1: (struct){ 2496 - - #Schema: (#struct){ 2497 - - a: (_){ matchN(1, (#list){ 2498 - - 0: (_|_){// "all" 2499 - - } 2500 - - 1: (_|_){// { 2501 - - // foo: "bar" 2502 - - // } 2503 - - } 2504 - - }) } 2505 - - } 2506 - - out: (#struct){ 2485 + out: (#struct){ 2507 2486 - a: (struct){ 2508 - + ok1: (_|_){ 2509 - + // [eval] 2510 - + #Schema: (#struct){ 2511 - + a: (_){ matchN(1, (#list){ 2512 - + 0: (_|_){// "all" 2513 - + } 2514 - + 1: (_|_){// { 2515 - + // foo: "bar" 2516 - + // } 2517 - + } 2518 - + }) } 2519 - + } 2520 - + out: (_|_){ 2521 - + // [eval] 2522 - + a: (_|_){ 2523 - + // [eval] openArguments.ok1.out.a: conflicting values "all" and {baz:"allowed"} (mismatched types string and struct): 2524 - + // ./closedness.cue:13:6 2525 - + // ./closedness.cue:13:17 2526 - + // ./closedness.cue:16:6 2527 - + // openArguments.ok1.out.a: invalid value {baz:"allowed"} (does not satisfy matchN): 0 matched, expected 1: 2528 - + // ./closedness.cue:13:6 2529 - + // ./closedness.cue:13:13 2530 - + // ./closedness.cue:16:6 2531 - + // openArguments.ok1.out.a.baz: field not allowed: 2532 - + // ./closedness.cue:13:6 2533 - + // ./closedness.cue:16:11 2487 + + a: (#struct){ 2534 2488 baz: (string){ "allowed" } 2535 2489 } 2536 2490 } 2537 - } 2538 - - err2: (_|_){ 2539 - - // [eval] 2540 - + err2: (struct){ 2541 - #Schema: (#struct){ 2542 - a?: (_){ matchN(1, (#list){ 2543 - 0: (_|_){// null 2544 - @@ -268,19 +257,8 @@ 2545 - } 2546 - }) } 2547 - } 2548 - - out: (_|_){ 2549 - - // [eval] 2550 - - a: (_|_){ 2551 - - // [eval] openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 2491 + @@ -272,15 +249,16 @@ 2492 + // [eval] 2493 + a: (_|_){ 2494 + // [eval] openArguments.err2.out.a: conflicting values null and {allowed:"once"} (mismatched types null and struct): 2552 2495 - // ./closedness.cue:20:12 2553 2496 - // ./closedness.cue:21:13 2554 2497 - // ./closedness.cue:22:5 2555 2498 - // ./closedness.cue:27:7 2556 - - // ./closedness.cue:28:6 2557 - - // openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 2558 - - // ./closedness.cue:21:13 2559 - - // ./closedness.cue:21:20 2560 - - // ./closedness.cue:28:6 2561 - + out: (#struct){ 2562 - + a: (#struct){ 2499 + + // ./closedness.cue:21:13 2500 + + // ./closedness.cue:22:5 2501 + // ./closedness.cue:28:6 2502 + // openArguments.err2.out.a: invalid value {allowed:"once"} (does not satisfy matchN): 2 matched, expected 1: 2503 + // ./closedness.cue:21:13 2504 + // ./closedness.cue:21:20 2505 + // ./closedness.cue:28:6 2506 + + // openArguments.err2.out.a: cannot combine regular field "allowed" with null: 2507 + + // ./closedness.cue:28:15 2508 + + // ./closedness.cue:22:5 2563 2509 allowed: (string){ "once" } 2564 2510 } 2565 2511 } ··· 2568 2514 a: (_|_){ 2569 2515 // [eval] explicitClose.err1.out.a: conflicting values "all" and {baz:"notAllowed"} (mismatched types string and struct): 2570 2516 - // ./closedness.cue:32:12 2571 - // ./closedness.cue:33:6 2572 - // ./closedness.cue:33:17 2517 + - // ./closedness.cue:33:6 2518 + - // ./closedness.cue:33:17 2573 2519 - // ./closedness.cue:35:7 2520 + + // ./closedness.cue:33:6 2521 + + // ./closedness.cue:33:17 2574 2522 // ./closedness.cue:36:6 2575 2523 // explicitClose.err1.out.a: invalid value {baz:"notAllowed"} (does not satisfy matchN): 0 matched, expected 1: 2576 2524 // ./closedness.cue:33:6 2577 - @@ -315,10 +291,9 @@ 2525 + @@ -314,12 +290,11 @@ 2526 + // ./closedness.cue:33:13 2578 2527 // ./closedness.cue:36:6 2579 2528 // explicitClose.err1.out.a.baz: field not allowed: 2580 - // ./closedness.cue:33:6 2529 + - // ./closedness.cue:33:6 2581 2530 - // ./closedness.cue:32:12 2582 - + // ./closedness.cue:36:11 2583 - + // explicitClose.err1.out.a.baz: field not allowed: 2584 2531 // ./closedness.cue:33:24 2585 2532 - // ./closedness.cue:33:30 2586 2533 - // ./closedness.cue:35:7 2587 - // ./closedness.cue:36:11 2534 + - // ./closedness.cue:36:11 2535 + + // ./closedness.cue:36:11 2536 + + // explicitClose.err1.out.a: cannot combine regular field "baz" with "all": 2537 + + // ./closedness.cue:36:11 2538 + + // ./closedness.cue:33:17 2588 2539 baz: (string){ "notAllowed" } 2589 2540 } 2541 + } 2590 2542 @@ -342,7 +317,7 @@ 2591 2543 }) } 2592 2544 } ··· 2596 2548 allowed: (string){ "once" } 2597 2549 } 2598 2550 } 2599 - @@ -375,20 +350,20 @@ 2551 + @@ -375,7 +350,7 @@ 2600 2552 } 2601 2553 } 2602 2554 out: (#struct){ 2603 2555 - exports: (struct){ 2604 - - exp1: (string){ "./main-module.js" } 2605 - - } 2606 - - #exports: (_){ matchN(1, (#list){ 2607 - - 0: (_|_){// string 2608 - - } 2609 - - 1: (_|_){// 〈1;#exportsObject〉 2610 - - } 2611 - - }) } 2612 - - #exportsObject: (#struct){ 2613 - - exp1?: (_){ matchN(1, (#list){ 2614 - - 0: (_|_){// string 2615 - - } 2616 - - 1: (_|_){// 〈1;#exportsObject〉 2617 2556 + exports: (#struct){ 2618 - + exp1: (string){ "./main-module.js" } 2619 - + } 2620 - + #exports: (_){ matchN(1, (#list){ 2621 - + 0: (_|_){// [d]&[string] 2622 - + } 2623 - + 1: (_|_){// [d]&[〈1;#exportsObject〉] 2624 - + } 2625 - + }) } 2626 - + #exportsObject: (#struct){ 2627 - + exp1?: (_){ matchN(1, (#list){ 2628 - + 0: (_|_){// [d]&[string] 2629 - + } 2630 - + 1: (_|_){// [d]&[〈1;#exportsObject〉] 2631 - } 2632 - }) } 2557 + exp1: (string){ "./main-module.js" } 2633 2558 } 2634 - @@ -421,20 +396,20 @@ 2559 + #exports: (_){ matchN(1, (#list){ 2560 + @@ -421,7 +396,7 @@ 2635 2561 } 2636 2562 } 2637 2563 out: (#struct){ 2638 2564 - exports: (struct){ 2639 - - exp1: (string){ "./main-module.js" } 2640 - - } 2641 - - #exports: (_){ matchN(1, (#list){ 2642 - - 0: (_|_){// string 2643 - - } 2644 - - 1: (_|_){// 〈1;#exportsObject〉 2645 - - } 2646 - - }) } 2647 - - #exportsObject: (#struct){ 2648 - - exp1?: (_){ matchN(1, (#list){ 2649 - - 0: (_|_){// string 2650 - - } 2651 - - 1: (_|_){// 〈1;#exportsObject〉 2652 2565 + exports: (#struct){ 2653 - + exp1: (string){ "./main-module.js" } 2654 - + } 2655 - + #exports: (_){ matchN(1, (#list){ 2656 - + 0: (_|_){// [d]&[string] 2657 - + } 2658 - + 1: (_|_){// [d]&[〈1;#exportsObject〉] 2659 - + } 2660 - + }) } 2661 - + #exportsObject: (#struct){ 2662 - + exp1?: (_){ matchN(1, (#list){ 2663 - + 0: (_|_){// [d]&[string] 2664 - + } 2665 - + 1: (_|_){// [d]&[〈1;#exportsObject〉] 2666 - } 2667 - }) } 2566 + exp1: (string){ "./main-module.js" } 2668 2567 } 2669 - @@ -470,25 +445,20 @@ 2568 + #exports: (_){ matchN(1, (#list){ 2569 + @@ -470,20 +445,12 @@ 2670 2570 // [eval] closedByDefinition.err5.out.exports: conflicting values null and {exp1:"./main-module.js"} (mismatched types null and struct): 2671 2571 // ./closedness.cue:80:13 2672 2572 // ./closedness.cue:80:24 ··· 2687 2587 // ./closedness.cue:86:18 2688 2588 // closedByDefinition.err5.out.exports: invalid value {exp1:"./main-module.js"} (does not satisfy matchN): 0 matched, expected 1: 2689 2589 // ./closedness.cue:80:13 2690 - // ./closedness.cue:80:20 2691 - // ./closedness.cue:86:12 2692 - + // closedByDefinition.err5.out.exports.exp1: field not allowed: 2693 - + // ./closedness.cue:80:13 2694 - + // ./closedness.cue:86:18 2695 - // closedByDefinition.err5.out.exports.exp1: invalid value "./main-module.js" (does not satisfy matchN): 0 matched, expected 1: 2696 - // ./closedness.cue:81:13 2590 + @@ -494,6 +461,9 @@ 2697 2591 // ./closedness.cue:81:20 2698 - @@ -497,16 +467,16 @@ 2592 + // ./closedness.cue:82:26 2593 + // ./closedness.cue:86:18 2594 + + // closedByDefinition.err5.out.exports: cannot combine regular field "exp1" with null: 2595 + + // ./closedness.cue:86:18 2596 + + // ./closedness.cue:80:24 2699 2597 exp1: (string){ "./main-module.js" } 2700 2598 } 2701 2599 #exports: (_){ matchN(1, (#list){ 2702 - - 0: (_|_){// null 2703 - - } 2704 - - 1: (_|_){// 〈1;#exportsObject〉 2705 - - } 2706 - - }) } 2707 - - #exportsObject: (#struct){ 2708 - - exp1?: (_){ matchN(1, (#list){ 2709 - - 0: (_|_){// null 2710 - - } 2711 - - 1: (_|_){// 〈1;#exportsObject〉 2712 - + 0: (_|_){// [d]&[null] 2713 - + } 2714 - + 1: (_|_){// [d]&[〈1;#exportsObject〉] 2715 - + } 2716 - + }) } 2717 - + #exportsObject: (#struct){ 2718 - + exp1?: (_){ matchN(1, (#list){ 2719 - + 0: (_|_){// [d]&[null] 2720 - + } 2721 - + 1: (_|_){// [d]&[〈1;#exportsObject〉] 2722 - } 2723 - }) } 2724 - } 2725 2600 @@ -524,8 +494,6 @@ 2726 2601 singleErr: (_|_){ 2727 2602 // [eval] match.singleErr.a: conflicting values "foo" and int (mismatched types string and int): ··· 2807 2682 mid-evaluation. The new evaluator does. 2808 2683 issue3575: the old evaluator was incorrect in behaving differently when using structs inside lists 2809 2684 closedness.cue: several discrepancies. EvalV3 is correct in all cases. 2810 - -- diff/todo/p1 -- 2811 - openArguments.*: arguments to functions should always be treated as open. 2812 2685 -- diff/todo/p3 -- 2813 2686 Missing error positions. 2814 2687 -- out/compile --
+2 -2
cue/testdata/cycle/builtins.txtar
··· 262 262 Retain: 0 263 263 264 264 Unifications: 409 265 - Conjuncts: 920 265 + Conjuncts: 916 266 266 Disjuncts: 38 267 267 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 268 268 diff old new ··· 284 284 -Conjuncts: 821 285 285 -Disjuncts: 537 286 286 +Unifications: 409 287 - +Conjuncts: 920 287 + +Conjuncts: 916 288 288 +Disjuncts: 38 289 289 -- out/eval/stats -- 290 290 Leaks: 25
+22 -3
internal/core/adt/expr.go
··· 1568 1568 c.AddErrf("cannot call non-function %s (type %s)", x.Fun, kind(fun)) 1569 1569 return nil 1570 1570 } 1571 + 1572 + // Arguments to functions are open. This mostly matters for NonConcrete 1573 + // builtins. 1574 + saved := c.ci 1575 + c.ci.FromDef = false 1576 + c.ci.FromEmbed = false 1577 + defer func() { 1578 + c.ci.FromDef = saved.FromDef 1579 + c.ci.FromEmbed = saved.FromEmbed 1580 + }() 1581 + 1571 1582 args := []Value{} 1572 1583 for i, a := range x.Args { 1573 1584 saved := c.errs ··· 1774 1785 } 1775 1786 } 1776 1787 1788 + // Arguments to functions are open. This mostly matters for NonConcrete 1789 + // builtins. 1777 1790 saved := c.IsValidator 1778 1791 c.IsValidator = call.isValidator 1779 - ret := x.Func(call) 1780 - c.IsValidator = saved 1792 + ci := c.ci 1793 + c.ci.FromEmbed = false 1794 + c.ci.FromDef = false 1795 + defer func() { 1796 + c.ci.FromDef = ci.FromDef 1797 + c.ci.FromEmbed = ci.FromEmbed 1798 + c.IsValidator = saved 1799 + }() 1781 1800 1782 - return ret 1801 + return x.Func(call) 1783 1802 } 1784 1803 1785 1804 func (x *Builtin) Source() ast.Node { return nil }
+1 -104
pkg/encoding/yaml/testdata/validate.txtar
··· 6 6 7 7 data1: "a: 2" 8 8 t1: [string]: data1 9 - t1: ok1: fn({a!: int} | {b!: int}) 9 + t1: ok1: fn({a!: int} | {b!: int}) // TODO: filter unsatisfied required fields. 10 10 t1: ok2: fn(close({a: int}) | close({b: int})) 11 11 12 12 #A: {a: int} ··· 32 32 } 33 33 -- diff/todo -- 34 34 missing position 35 - -- out/yaml-v3 -- 36 - Errors: 37 - #test.t1.ok1: cannot call non-function fn (type _): 38 - ./in.cue:8:11 39 - #test.t1.ok2: cannot call non-function fn (type _): 40 - ./in.cue:9:11 41 - #test.t1.ok3: cannot call non-function fn (type _): 42 - ./in.cue:13:11 43 - #test.t2.ok1: cannot call non-function fn (type _): 44 - ./in.cue:17:11 45 - #test.t2.ok2: cannot call non-function fn (type _): 46 - ./in.cue:18:11 47 - 48 - Result: 49 - import "encoding/yaml" 50 - 51 - #test: { 52 - fn: _ 53 - data1: "a: 2" 54 - t1: { 55 - ok1: _|_ // #test.t1.ok1: cannot call non-function fn (type _) 56 - ok2: _|_ // #test.t1.ok2: cannot call non-function fn (type _) 57 - ok3: _|_ // #test.t1.ok3: cannot call non-function fn (type _) 58 - } 59 - #A: { 60 - a: int 61 - } 62 - #B: { 63 - b: int 64 - } 65 - data2: "'foo'" 66 - t2: { 67 - ok1: _|_ // #test.t2.ok1: cannot call non-function fn (type _) 68 - ok2: _|_ // #test.t2.ok2: cannot call non-function fn (type _) 69 - } 70 - } 71 - validate: { 72 - fn: yaml.Validate 73 - data1: "a: 2" 74 - 75 - // TODO: fix this test: the second disjunct should be eliminated, so there 76 - // should not be a concreteness error. 77 - t1: { 78 - ok1: "a: 2" 79 - ok2: "a: 2" 80 - ok3: "a: 2" 81 - } 82 - #A: { 83 - a: int 84 - } 85 - #B: { 86 - b: int 87 - } 88 - data2: "'foo'" 89 - t2: { 90 - ok1: "'foo'" 91 - ok2: "'foo'" 92 - } 93 - } 94 - validatePartial: { 95 - fn: yaml.ValidatePartial 96 - data1: "a: 2" 97 - t1: { 98 - ok1: "a: 2" 99 - ok2: "a: 2" 100 - ok3: "a: 2" 101 - } 102 - #A: { 103 - a: int 104 - } 105 - #B: { 106 - b: int 107 - } 108 - data2: "'foo'" 109 - t2: { 110 - ok1: "'foo'" 111 - ok2: "'foo'" 112 - } 113 - } 114 - -- diff/-out/yaml-v3<==>+out/yaml -- 115 - diff old new 116 - --- old 117 - +++ new 118 - @@ -1,10 +1,6 @@ 119 - Errors: 120 - #test.t1.ok1: cannot call non-function fn (type _): 121 - ./in.cue:8:11 122 - -validate.t1.ok1: invalid value "a: 2" (does not satisfy encoding/yaml.Validate): error in call to encoding/yaml.Validate: incomplete value {a:2} | {a:2,b!:int}: 123 - - ./in.cue:8:11 124 - - ./in.cue:6:9 125 - - ./in.cue:7:16 126 - #test.t1.ok2: cannot call non-function fn (type _): 127 - ./in.cue:9:11 128 - #test.t1.ok3: cannot call non-function fn (type _): 129 - @@ -44,7 +40,7 @@ 130 - // TODO: fix this test: the second disjunct should be eliminated, so there 131 - // should not be a concreteness error. 132 - t1: { 133 - - ok1: _|_ // validate.t1.ok1: invalid value "a: 2" (does not satisfy encoding/yaml.Validate): validate.t1.ok1: error in call to encoding/yaml.Validate: validate.t1.ok1: incomplete value {a:2} | {a:2,b!:int} 134 - + ok1: "a: 2" 135 - ok2: "a: 2" 136 - ok3: "a: 2" 137 - } 138 35 -- out/yaml -- 139 36 Errors: 140 37 #test.t1.ok1: cannot call non-function fn (type _):