cuelang.org/go@v0.13.0/cue/testdata/resolve/044_field_templates.txtar (about) 1 #name: field templates 2 #evalPartial 3 -- in.cue -- 4 a: { 5 {[name=_]: int} 6 k: 1 7 } 8 b: { 9 {[X=_]: {x: 0, y: *1 | int}} 10 v: {} 11 w: {x: 0} 12 } 13 b: {[y=_]: {}} 14 c: { 15 {[Name=_]: {name: Name, y: 1}} 16 foo: {} 17 bar: _ 18 } 19 -- out/def -- 20 a: { 21 {[name=string]: int} 22 k: 1 23 } 24 b: { 25 {[X=string]: { 26 x: 0, y: *1 | int 27 }} 28 v: { 29 x: 0 30 y: *1 | int 31 } 32 w: { 33 x: 0 34 y: *1 | int 35 } 36 } 37 c: { 38 {[Name=string]: { 39 y: 1, name: Name 40 }} 41 foo: { 42 y: 1 43 name: "foo" 44 } 45 bar: { 46 y: 1 47 name: "bar" 48 } 49 } 50 -- out/export -- 51 a: { 52 k: 1 53 } 54 b: { 55 v: { 56 x: 0 57 y: 1 58 } 59 w: { 60 x: 0 61 y: 1 62 } 63 } 64 c: { 65 foo: { 66 y: 1 67 name: "foo" 68 } 69 bar: { 70 y: 1 71 name: "bar" 72 } 73 } 74 -- out/yaml -- 75 a: 76 k: 1 77 b: 78 v: 79 x: 0 80 y: 1 81 w: 82 x: 0 83 y: 1 84 c: 85 foo: 86 y: 1 87 name: foo 88 bar: 89 y: 1 90 name: bar 91 -- out/json -- 92 {"a":{"k":1},"b":{"v":{"x":0,"y":1},"w":{"x":0,"y":1}},"c":{"foo":{"y":1,"name":"foo"},"bar":{"y":1,"name":"bar"}}} 93 -- out/legacy-debug -- 94 <0>{a: <1>{[]: <2>(name: string)->int, k: 1}, b: <3>{[]: <4>(X: string)->(<5>{x: 0, y: (*1 | int)} & <6>{}), v: <7>{x: 0, y: (*1 | int)}, w: <8>{x: 0, y: (*1 | int)}}, c: <9>{[]: <10>(Name: string)-><11>{y: 1, name: <10>.Name}, foo: <12>{y: 1, name: "foo"}, bar: <13>{y: 1, name: "bar"}}} 95 -- out/compile -- 96 --- in.cue 97 { 98 a: { 99 { 100 [_]: int 101 } 102 k: 1 103 } 104 b: { 105 { 106 [_]: { 107 x: 0 108 y: (*1|int) 109 } 110 } 111 v: {} 112 w: { 113 x: 0 114 } 115 } 116 b: { 117 [_]: {} 118 } 119 c: { 120 { 121 [_]: { 122 name: 〈1;-〉 123 y: 1 124 } 125 } 126 foo: {} 127 bar: _ 128 } 129 } 130 -- out/eval/stats -- 131 Leaks: 0 132 Freed: 21 133 Reused: 15 134 Allocs: 6 135 Retain: 0 136 137 Unifications: 17 138 Conjuncts: 33 139 Disjuncts: 21 140 -- out/eval -- 141 (struct){ 142 a: (struct){ 143 k: (int){ 1 } 144 } 145 b: (struct){ 146 v: (struct){ 147 x: (int){ 0 } 148 y: (int){ |(*(int){ 1 }, (int){ int }) } 149 } 150 w: (struct){ 151 x: (int){ 0 } 152 y: (int){ |(*(int){ 1 }, (int){ int }) } 153 } 154 } 155 c: (struct){ 156 foo: (struct){ 157 name: (string){ "foo" } 158 y: (int){ 1 } 159 } 160 bar: (struct){ 161 name: (string){ "bar" } 162 y: (int){ 1 } 163 } 164 } 165 }