cuelang.org/go@v0.10.1/cue/testdata/scalars/emptystruct.txtar (about) 1 // Issue #783 2 3 -- in.cue -- 4 elipsis: { 5 test1: { 6 string 7 #foo: "bar" 8 } 9 10 #Def: { 11 ... 12 #foo: string 13 _ 14 } 15 check: test1 & #Def 16 } 17 18 bulk: { 19 test1: { 20 string 21 #foo: "bar" 22 } 23 24 #Def: { 25 [string]: int 26 #foo: string 27 _ 28 } 29 check: test1 & #Def 30 } 31 32 optional: { 33 test1: { 34 string 35 #foo: "bar" 36 } 37 38 #Def: { 39 bar?: int 40 #foo: string 41 _ 42 } 43 check: test1 & #Def 44 } 45 46 issue783: { 47 test1: { 48 string 49 #foo: "bar" 50 } 51 52 test2: { 53 hello: "world" 54 #foo: "bar" 55 } 56 57 #Def1: { 58 ... 59 #foo: string 60 } | { 61 string 62 #foo: string 63 } 64 check1a: test1 & #Def1 65 check1b: test2 & #Def1 66 67 #Def2: { 68 ... 69 #foo: string 70 _ 71 } 72 check2a: test1 & #Def2 73 check2b: test2 & #Def2 74 } 75 -- out/eval/stats -- 76 Leaks: 0 77 Freed: 54 78 Reused: 48 79 Allocs: 6 80 Retain: 0 81 82 Unifications: 48 83 Conjuncts: 107 84 Disjuncts: 54 85 -- out/eval -- 86 (struct){ 87 elipsis: (struct){ 88 test1: (string){ 89 string 90 #foo: (string){ "bar" } 91 } 92 #Def: (_){ 93 _ 94 #foo: (string){ string } 95 } 96 check: (string){ 97 string 98 #foo: (string){ "bar" } 99 } 100 } 101 bulk: (struct){ 102 test1: (string){ 103 string 104 #foo: (string){ "bar" } 105 } 106 #Def: (_){ 107 _ 108 #foo: (string){ string } 109 } 110 check: (string){ 111 string 112 #foo: (string){ "bar" } 113 } 114 } 115 optional: (struct){ 116 test1: (string){ 117 string 118 #foo: (string){ "bar" } 119 } 120 #Def: (_){ 121 _ 122 bar?: (int){ int } 123 #foo: (string){ string } 124 } 125 check: (string){ 126 string 127 #foo: (string){ "bar" } 128 bar?: (int){ int } 129 } 130 } 131 issue783: (struct){ 132 test1: (string){ 133 string 134 #foo: (string){ "bar" } 135 } 136 test2: (struct){ 137 hello: (string){ "world" } 138 #foo: (string){ "bar" } 139 } 140 #Def1: ((string|struct)){ |((#struct){ 141 #foo: (string){ string } 142 }, (string){ 143 string 144 #foo: (string){ string } 145 }) } 146 check1a: (string){ 147 string 148 #foo: (string){ "bar" } 149 } 150 check1b: (#struct){ 151 hello: (string){ "world" } 152 #foo: (string){ "bar" } 153 } 154 #Def2: (_){ 155 _ 156 #foo: (string){ string } 157 } 158 check2a: (string){ 159 string 160 #foo: (string){ "bar" } 161 } 162 check2b: (#struct){ 163 hello: (string){ "world" } 164 #foo: (string){ "bar" } 165 } 166 } 167 } 168 -- out/compile -- 169 --- in.cue 170 { 171 elipsis: { 172 test1: { 173 string 174 #foo: "bar" 175 } 176 #Def: { 177 ... 178 #foo: string 179 _ 180 } 181 check: (〈0;test1〉 & 〈0;#Def〉) 182 } 183 bulk: { 184 test1: { 185 string 186 #foo: "bar" 187 } 188 #Def: { 189 [string]: int 190 #foo: string 191 _ 192 } 193 check: (〈0;test1〉 & 〈0;#Def〉) 194 } 195 optional: { 196 test1: { 197 string 198 #foo: "bar" 199 } 200 #Def: { 201 bar?: int 202 #foo: string 203 _ 204 } 205 check: (〈0;test1〉 & 〈0;#Def〉) 206 } 207 issue783: { 208 test1: { 209 string 210 #foo: "bar" 211 } 212 test2: { 213 hello: "world" 214 #foo: "bar" 215 } 216 #Def1: ({ 217 ... 218 #foo: string 219 }|{ 220 string 221 #foo: string 222 }) 223 check1a: (〈0;test1〉 & 〈0;#Def1〉) 224 check1b: (〈0;test2〉 & 〈0;#Def1〉) 225 #Def2: { 226 ... 227 #foo: string 228 _ 229 } 230 check2a: (〈0;test1〉 & 〈0;#Def2〉) 231 check2b: (〈0;test2〉 & 〈0;#Def2〉) 232 } 233 }