cuelang.org/go@v0.13.0/cue/testdata/definitions/issue342.txtar (about) 1 -- in.cue -- 2 X: { 3 #Simple: { 4 ref: string 5 } 6 7 #Complex: { 8 { 9 ref: string 10 } | { 11 local: string 12 } 13 } 14 15 var: "XXX" 16 17 // Validate(concrete) after Fill() on Complex.ref from a "static" key will succeed 18 "test_1": #Complex 19 20 // Validate(concrete) after Fill() on "#Simple.ref" from a "dynamic" key will succeed 21 "test_2_\(var)": #Simple 22 23 // Validate(concrete) after Fill() on Complex.ref from a "dynamic" key will fail 24 "test_3_\(var)": #Complex 25 26 test_3_XXX: ref: "FOO" 27 } 28 29 Z: X.test_3_XXX.ref 30 -- out/eval/stats -- 31 Leaks: 0 32 Freed: 24 33 Reused: 17 34 Allocs: 7 35 Retain: 2 36 37 Unifications: 18 38 Conjuncts: 33 39 Disjuncts: 24 40 -- out/evalalpha -- 41 (struct){ 42 X: (struct){ 43 #Simple: (#struct){ 44 ref: (string){ string } 45 } 46 #Complex: (#struct){ |((#struct){ 47 ref: (string){ string } 48 }, (#struct){ 49 local: (string){ string } 50 }) } 51 var: (string){ "XXX" } 52 test_1: (#struct){ |((#struct){ 53 ref: (string){ string } 54 }, (#struct){ 55 local: (string){ string } 56 }) } 57 test_3_XXX: (#struct){ 58 ref: (string){ "FOO" } 59 } 60 test_2_XXX: ~(X.#Simple) 61 } 62 Z: (string){ "FOO" } 63 } 64 -- diff/-out/evalalpha<==>+out/eval -- 65 diff old new 66 --- old 67 +++ new 68 @@ -17,9 +17,7 @@ 69 test_3_XXX: (#struct){ 70 ref: (string){ "FOO" } 71 } 72 - test_2_XXX: (#struct){ 73 - ref: (string){ string } 74 - } 75 + test_2_XXX: ~(X.#Simple) 76 } 77 Z: (string){ "FOO" } 78 } 79 -- out/eval -- 80 (struct){ 81 X: (struct){ 82 #Simple: (#struct){ 83 ref: (string){ string } 84 } 85 #Complex: (#struct){ |((#struct){ 86 ref: (string){ string } 87 }, (#struct){ 88 local: (string){ string } 89 }) } 90 var: (string){ "XXX" } 91 test_1: (#struct){ |((#struct){ 92 ref: (string){ string } 93 }, (#struct){ 94 local: (string){ string } 95 }) } 96 test_3_XXX: (#struct){ 97 ref: (string){ "FOO" } 98 } 99 test_2_XXX: (#struct){ 100 ref: (string){ string } 101 } 102 } 103 Z: (string){ "FOO" } 104 } 105 -- out/compile -- 106 --- in.cue 107 { 108 X: { 109 #Simple: { 110 ref: string 111 } 112 #Complex: { 113 ({ 114 ref: string 115 }|{ 116 local: string 117 }) 118 } 119 var: "XXX" 120 test_1: 〈0;#Complex〉 121 "test_2_\(〈0;var〉)": 〈0;#Simple〉 122 "test_3_\(〈0;var〉)": 〈0;#Complex〉 123 test_3_XXX: { 124 ref: "FOO" 125 } 126 } 127 Z: 〈0;X〉.test_3_XXX.ref 128 }