cuelang.org/go@v0.13.0/cue/testdata/definitions/embed.txtar (about) 1 -- in.cue -- 2 deployment: [string]: #Deployment 3 4 deployment: foo: spec: replicas: 1 5 6 #Deployment: { 7 #TypeMeta 8 9 spec: #Spec 10 } 11 12 #Spec: replicas: int 13 14 #TypeMeta: {} 15 16 recloseSimple: { 17 #foo: {} 18 a: {#foo} & {b: int} 19 } 20 21 // Reclosing 22 reclose1: { 23 #D: { 24 x: int 25 y: int 26 } 27 #a: { 28 #D 29 b: { 30 c: int 31 } 32 } 33 34 z: #a.b 35 z: d: 3 // don't allow this 36 } 37 38 reclose2: { 39 #D: { 40 x: int 41 y: int 42 } 43 a: { 44 #D 45 b: {// keep open 46 c: int 47 } 48 } 49 50 z: a.b 51 z: d: 3 // allow this 52 } 53 54 reclose3: { 55 #Step: { 56 (#A | #B) 57 #Common 58 } 59 #Common: { 60 Name: string 61 } 62 #A: { 63 #Common 64 Something: int 65 } 66 #B: { 67 #Common 68 Else: int 69 } 70 x: #Step 71 x: #A & { 72 Name: "a" 73 Something: 4 74 } 75 } 76 -- out/eval/stats -- 77 Leaks: 0 78 Freed: 63 79 Reused: 56 80 Allocs: 7 81 Retain: 6 82 83 Unifications: 59 84 Conjuncts: 124 85 Disjuncts: 69 86 -- out/evalalpha -- 87 Errors: 88 reclose1.z.d: field not allowed: 89 ./in.cue:34:5 90 recloseSimple.a.b: field not allowed: 91 ./in.cue:17:15 92 93 Result: 94 (_|_){ 95 // [eval] 96 deployment: (struct){ 97 foo: (#struct){ 98 spec: (#struct){ 99 replicas: (int){ 1 } 100 } 101 } 102 } 103 #Deployment: (#struct){ 104 spec: ~(#Spec) 105 } 106 #Spec: (#struct){ 107 replicas: (int){ int } 108 } 109 #TypeMeta: (#struct){ 110 } 111 recloseSimple: (_|_){ 112 // [eval] 113 #foo: (#struct){ 114 } 115 a: (_|_){ 116 // [eval] 117 b: (_|_){ 118 // [eval] recloseSimple.a.b: field not allowed: 119 // ./in.cue:17:15 120 } 121 } 122 } 123 reclose1: (_|_){ 124 // [eval] 125 #D: (#struct){ 126 x: (int){ int } 127 y: (int){ int } 128 } 129 #a: (#struct){ 130 b: (#struct){ 131 c: (int){ int } 132 } 133 x: (int){ int } 134 y: (int){ int } 135 } 136 z: (_|_){ 137 // [eval] 138 d: (_|_){ 139 // [eval] reclose1.z.d: field not allowed: 140 // ./in.cue:34:5 141 } 142 c: (int){ int } 143 } 144 } 145 reclose2: (struct){ 146 #D: (#struct){ 147 x: (int){ int } 148 y: (int){ int } 149 } 150 a: (#struct){ 151 b: (struct){ 152 c: (int){ int } 153 } 154 x: (int){ int } 155 y: (int){ int } 156 } 157 z: (struct){ 158 d: (int){ 3 } 159 c: (int){ int } 160 } 161 } 162 reclose3: (struct){ 163 #Step: (#struct){ |((#struct){ 164 Name: (string){ string } 165 Something: (int){ int } 166 }, (#struct){ 167 Name: (string){ string } 168 Else: (int){ int } 169 }) } 170 #Common: (#struct){ 171 Name: (string){ string } 172 } 173 #A: (#struct){ 174 Something: (int){ int } 175 Name: (string){ string } 176 } 177 #B: (#struct){ 178 Else: (int){ int } 179 Name: (string){ string } 180 } 181 x: (#struct){ 182 Name: (string){ "a" } 183 Something: (int){ 4 } 184 } 185 } 186 } 187 -- diff/-out/evalalpha<==>+out/eval -- 188 diff old new 189 --- old 190 +++ new 191 @@ -1,12 +1,7 @@ 192 Errors: 193 reclose1.z.d: field not allowed: 194 - ./in.cue:28:6 195 - ./in.cue:33:5 196 ./in.cue:34:5 197 recloseSimple.a.b: field not allowed: 198 - ./in.cue:16:8 199 - ./in.cue:17:5 200 - ./in.cue:17:6 201 ./in.cue:17:15 202 203 Result: 204 @@ -20,9 +15,7 @@ 205 } 206 } 207 #Deployment: (#struct){ 208 - spec: (#struct){ 209 - replicas: (int){ int } 210 - } 211 + spec: ~(#Spec) 212 } 213 #Spec: (#struct){ 214 replicas: (int){ int } 215 @@ -37,9 +30,6 @@ 216 // [eval] 217 b: (_|_){ 218 // [eval] recloseSimple.a.b: field not allowed: 219 - // ./in.cue:16:8 220 - // ./in.cue:17:5 221 - // ./in.cue:17:6 222 // ./in.cue:17:15 223 } 224 } 225 @@ -51,21 +41,19 @@ 226 y: (int){ int } 227 } 228 #a: (#struct){ 229 - x: (int){ int } 230 - y: (int){ int } 231 b: (#struct){ 232 c: (int){ int } 233 } 234 + x: (int){ int } 235 + y: (int){ int } 236 } 237 z: (_|_){ 238 // [eval] 239 - c: (int){ int } 240 d: (_|_){ 241 // [eval] reclose1.z.d: field not allowed: 242 - // ./in.cue:28:6 243 - // ./in.cue:33:5 244 // ./in.cue:34:5 245 } 246 + c: (int){ int } 247 } 248 } 249 reclose2: (struct){ 250 @@ -74,15 +62,15 @@ 251 y: (int){ int } 252 } 253 a: (#struct){ 254 - x: (int){ int } 255 - y: (int){ int } 256 b: (struct){ 257 c: (int){ int } 258 } 259 + x: (int){ int } 260 + y: (int){ int } 261 } 262 z: (struct){ 263 - c: (int){ int } 264 d: (int){ 3 } 265 + c: (int){ int } 266 } 267 } 268 reclose3: (struct){ 269 @@ -97,12 +85,12 @@ 270 Name: (string){ string } 271 } 272 #A: (#struct){ 273 - Name: (string){ string } 274 Something: (int){ int } 275 + Name: (string){ string } 276 } 277 #B: (#struct){ 278 - Name: (string){ string } 279 Else: (int){ int } 280 + Name: (string){ string } 281 } 282 x: (#struct){ 283 Name: (string){ "a" } 284 -- diff/todo/p3 -- 285 Reordering 286 Missing error positions 287 -- out/eval -- 288 Errors: 289 reclose1.z.d: field not allowed: 290 ./in.cue:28:6 291 ./in.cue:33:5 292 ./in.cue:34:5 293 recloseSimple.a.b: field not allowed: 294 ./in.cue:16:8 295 ./in.cue:17:5 296 ./in.cue:17:6 297 ./in.cue:17:15 298 299 Result: 300 (_|_){ 301 // [eval] 302 deployment: (struct){ 303 foo: (#struct){ 304 spec: (#struct){ 305 replicas: (int){ 1 } 306 } 307 } 308 } 309 #Deployment: (#struct){ 310 spec: (#struct){ 311 replicas: (int){ int } 312 } 313 } 314 #Spec: (#struct){ 315 replicas: (int){ int } 316 } 317 #TypeMeta: (#struct){ 318 } 319 recloseSimple: (_|_){ 320 // [eval] 321 #foo: (#struct){ 322 } 323 a: (_|_){ 324 // [eval] 325 b: (_|_){ 326 // [eval] recloseSimple.a.b: field not allowed: 327 // ./in.cue:16:8 328 // ./in.cue:17:5 329 // ./in.cue:17:6 330 // ./in.cue:17:15 331 } 332 } 333 } 334 reclose1: (_|_){ 335 // [eval] 336 #D: (#struct){ 337 x: (int){ int } 338 y: (int){ int } 339 } 340 #a: (#struct){ 341 x: (int){ int } 342 y: (int){ int } 343 b: (#struct){ 344 c: (int){ int } 345 } 346 } 347 z: (_|_){ 348 // [eval] 349 c: (int){ int } 350 d: (_|_){ 351 // [eval] reclose1.z.d: field not allowed: 352 // ./in.cue:28:6 353 // ./in.cue:33:5 354 // ./in.cue:34:5 355 } 356 } 357 } 358 reclose2: (struct){ 359 #D: (#struct){ 360 x: (int){ int } 361 y: (int){ int } 362 } 363 a: (#struct){ 364 x: (int){ int } 365 y: (int){ int } 366 b: (struct){ 367 c: (int){ int } 368 } 369 } 370 z: (struct){ 371 c: (int){ int } 372 d: (int){ 3 } 373 } 374 } 375 reclose3: (struct){ 376 #Step: (#struct){ |((#struct){ 377 Name: (string){ string } 378 Something: (int){ int } 379 }, (#struct){ 380 Name: (string){ string } 381 Else: (int){ int } 382 }) } 383 #Common: (#struct){ 384 Name: (string){ string } 385 } 386 #A: (#struct){ 387 Name: (string){ string } 388 Something: (int){ int } 389 } 390 #B: (#struct){ 391 Name: (string){ string } 392 Else: (int){ int } 393 } 394 x: (#struct){ 395 Name: (string){ "a" } 396 Something: (int){ 4 } 397 } 398 } 399 } 400 -- out/compile -- 401 --- in.cue 402 { 403 deployment: { 404 [string]: 〈1;#Deployment〉 405 } 406 deployment: { 407 foo: { 408 spec: { 409 replicas: 1 410 } 411 } 412 } 413 #Deployment: { 414 〈1;#TypeMeta〉 415 spec: 〈1;#Spec〉 416 } 417 #Spec: { 418 replicas: int 419 } 420 #TypeMeta: {} 421 recloseSimple: { 422 #foo: {} 423 a: ({ 424 〈1;#foo〉 425 } & { 426 b: int 427 }) 428 } 429 reclose1: { 430 #D: { 431 x: int 432 y: int 433 } 434 #a: { 435 〈1;#D〉 436 b: { 437 c: int 438 } 439 } 440 z: 〈0;#a〉.b 441 z: { 442 d: 3 443 } 444 } 445 reclose2: { 446 #D: { 447 x: int 448 y: int 449 } 450 a: { 451 〈1;#D〉 452 b: { 453 c: int 454 } 455 } 456 z: 〈0;a〉.b 457 z: { 458 d: 3 459 } 460 } 461 reclose3: { 462 #Step: { 463 (〈1;#A〉|〈1;#B〉) 464 〈1;#Common〉 465 } 466 #Common: { 467 Name: string 468 } 469 #A: { 470 〈1;#Common〉 471 Something: int 472 } 473 #B: { 474 〈1;#Common〉 475 Else: int 476 } 477 x: 〈0;#Step〉 478 x: (〈0;#A〉 & { 479 Name: "a" 480 Something: 4 481 }) 482 } 483 }