this repo has no description
0
fork

Configure Feed

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

cue/testdata: start a disjunctions/discriminator.txtar file

For now, it just demonstrates disjunctions where the disjuncts
can be discriminated by kind, such as the case below:

#Def: null | {f1: int}
out: #Def & {f1: "not an int"}

This CUE should fail, but the user most likely does not care about
the "mismatched types null and struct" error with the null disjunct;
once the data is a struct, we can focus on the error for the field f1.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I75699ba42e55fef158b1124ddc7ba6b438668e02
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1227406
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+642
+642
cue/testdata/disjunctions/discriminator.txtar
··· 1 + -- in.cue -- 2 + // Important that the test cases below fail with more than just 3 + // an incomplete error, as we want to track the quality of errors. 4 + 5 + // Disjunctions where multiple (or zero) disjuncts match by kind, 6 + // so we cannot discriminate. 7 + noKind: { 8 + manyWithStructEmbed: { 9 + #Def: {<10, _hidden: "field"} | >200 | string 10 + 11 + // The data is an int, but the struct embeds a matching scalar kind too. 12 + out: #Def & 123 13 + } 14 + manyStructsEmpty: { 15 + #Def: {f1!: int} | {f2!: int} | string 16 + 17 + // The data is a struct, which matches multiple disjunct struct kinds. 18 + out: #Def & {} 19 + } 20 + manyScalars: { 21 + #Def: 1 | 2 | 3 22 + 23 + // The data is an int, which matches all of the disjunct kinds. 24 + out: #Def & 123 25 + } 26 + zeroScalars: { 27 + #Def: int | string | null 28 + 29 + // The data is a bool, which matches none of the disjunct scalar kinds. 30 + out: #Def & true 31 + } 32 + } 33 + 34 + // Disjunctions where just one disjunct matches by kind, 35 + // so we can discriminate. 36 + byKind: { 37 + nullableStructRegular: { 38 + #Def1: {f1: null | #Def2} 39 + #Def2: {f2: null | #Def3} 40 + #Def3: {f3: null | int} 41 + 42 + // The data is a struct, not a null. 43 + out: #Def1 & {f1: f2: f3: "not an int"} 44 + } 45 + 46 + nullableStructRequired: { 47 + #Def1: {f1!: null | #Def2} 48 + #Def2: {f2!: null | #Def3} 49 + #Def3: {f3!: null | int} 50 + 51 + // The data is a struct, not a null. 52 + out: #Def1 & {f1: f2: f3: "not an int"} 53 + } 54 + 55 + nullableStructOptional: { 56 + #Def1: {f1?: null | #Def2} 57 + #Def2: {f2?: null | #Def3} 58 + #Def3: {f3?: null | int} 59 + 60 + // The data is a struct, not a null. 61 + out: #Def1 & {f1: f2: f3: "not an int"} 62 + } 63 + 64 + nullableList: { 65 + #Def1: [...null | #Def2] 66 + #Def2: [...null | #Def3] 67 + #Def3: [...null | int] 68 + 69 + // The data is a list, not a null. 70 + out: #Def1 & [[["not an int"]]] 71 + } 72 + 73 + scalarConstraints: { 74 + #Def: >10 | "" | null | false 75 + 76 + // The data is an integer, not any other scalar type. 77 + out: #Def & 5 78 + } 79 + } 80 + -- out/eval/stats -- 81 + -- out/evalalpha/stats -- 82 + Leaks: 0 83 + Freed: 188 84 + Reused: 167 85 + Allocs: 21 86 + Retain: 0 87 + 88 + Unifications: 74 89 + Conjuncts: 215 90 + Disjuncts: 92 91 + 92 + NumCloseIDs: 30 93 + -- out/evalalpha -- 94 + Errors: 95 + byKind.nullableList.out.0: 6 errors in empty disjunction: 96 + byKind.nullableList.out.0: conflicting values [["not an int"]] and null (mismatched types list and null): 97 + ./in.cue:64:14 98 + ./in.cue:69:8 99 + ./in.cue:69:17 100 + byKind.nullableList.out.0.0: 4 errors in empty disjunction: 101 + byKind.nullableList.out.0.0: conflicting values ["not an int"] and null (mismatched types list and null): 102 + ./in.cue:64:21 103 + ./in.cue:65:14 104 + ./in.cue:69:8 105 + ./in.cue:69:18 106 + byKind.nullableList.out.0.0.0: 2 errors in empty disjunction: 107 + byKind.nullableList.out.0.0.0: conflicting values "not an int" and int (mismatched types string and int): 108 + ./in.cue:64:21 109 + ./in.cue:65:21 110 + ./in.cue:66:21 111 + ./in.cue:69:8 112 + ./in.cue:69:19 113 + byKind.nullableList.out.0.0.0: conflicting values "not an int" and null (mismatched types string and null): 114 + ./in.cue:64:21 115 + ./in.cue:65:21 116 + ./in.cue:66:14 117 + ./in.cue:69:8 118 + ./in.cue:69:19 119 + byKind.nullableStructOptional.out.f1: 6 errors in empty disjunction: 120 + byKind.nullableStructOptional.out.f1: conflicting values null and {f2:{f3:"not an int"}} (mismatched types null and struct): 121 + ./in.cue:55:16 122 + ./in.cue:60:8 123 + ./in.cue:60:21 124 + byKind.nullableStructOptional.out.f1.f2: 4 errors in empty disjunction: 125 + byKind.nullableStructOptional.out.f1.f2: conflicting values null and {f3:"not an int"} (mismatched types null and struct): 126 + ./in.cue:55:23 127 + ./in.cue:56:16 128 + ./in.cue:60:8 129 + ./in.cue:60:25 130 + byKind.nullableStructOptional.out.f1.f2.f3: 2 errors in empty disjunction: 131 + byKind.nullableStructOptional.out.f1.f2.f3: conflicting values "not an int" and int (mismatched types string and int): 132 + ./in.cue:55:23 133 + ./in.cue:56:23 134 + ./in.cue:57:23 135 + ./in.cue:60:8 136 + ./in.cue:60:29 137 + byKind.nullableStructOptional.out.f1.f2.f3: conflicting values "not an int" and null (mismatched types string and null): 138 + ./in.cue:55:23 139 + ./in.cue:56:23 140 + ./in.cue:57:16 141 + ./in.cue:60:8 142 + ./in.cue:60:29 143 + byKind.nullableStructRegular.out.f1: 6 errors in empty disjunction: 144 + byKind.nullableStructRegular.out.f1: conflicting values null and {f2:{f3:"not an int"}} (mismatched types null and struct): 145 + ./in.cue:37:15 146 + ./in.cue:42:8 147 + ./in.cue:42:21 148 + byKind.nullableStructRegular.out.f1.f2: 4 errors in empty disjunction: 149 + byKind.nullableStructRegular.out.f1.f2: conflicting values null and {f3:"not an int"} (mismatched types null and struct): 150 + ./in.cue:37:22 151 + ./in.cue:38:15 152 + ./in.cue:42:8 153 + ./in.cue:42:25 154 + byKind.nullableStructRegular.out.f1.f2.f3: 2 errors in empty disjunction: 155 + byKind.nullableStructRegular.out.f1.f2.f3: conflicting values "not an int" and int (mismatched types string and int): 156 + ./in.cue:37:22 157 + ./in.cue:38:22 158 + ./in.cue:39:22 159 + ./in.cue:42:8 160 + ./in.cue:42:29 161 + byKind.nullableStructRegular.out.f1.f2.f3: conflicting values "not an int" and null (mismatched types string and null): 162 + ./in.cue:37:22 163 + ./in.cue:38:22 164 + ./in.cue:39:15 165 + ./in.cue:42:8 166 + ./in.cue:42:29 167 + byKind.nullableStructRequired.out.f1: 6 errors in empty disjunction: 168 + byKind.nullableStructRequired.out.f1: conflicting values null and {f2:{f3:"not an int"}} (mismatched types null and struct): 169 + ./in.cue:46:16 170 + ./in.cue:51:8 171 + ./in.cue:51:21 172 + byKind.nullableStructRequired.out.f1.f2: 4 errors in empty disjunction: 173 + byKind.nullableStructRequired.out.f1.f2: conflicting values null and {f3:"not an int"} (mismatched types null and struct): 174 + ./in.cue:46:23 175 + ./in.cue:47:16 176 + ./in.cue:51:8 177 + ./in.cue:51:25 178 + byKind.nullableStructRequired.out.f1.f2.f3: 2 errors in empty disjunction: 179 + byKind.nullableStructRequired.out.f1.f2.f3: conflicting values "not an int" and int (mismatched types string and int): 180 + ./in.cue:46:23 181 + ./in.cue:47:23 182 + ./in.cue:48:23 183 + ./in.cue:51:8 184 + ./in.cue:51:29 185 + byKind.nullableStructRequired.out.f1.f2.f3: conflicting values "not an int" and null (mismatched types string and null): 186 + ./in.cue:46:23 187 + ./in.cue:47:23 188 + ./in.cue:48:16 189 + ./in.cue:51:8 190 + ./in.cue:51:29 191 + byKind.scalarConstraints.out: 4 errors in empty disjunction: 192 + byKind.scalarConstraints.out: conflicting values 5 and "" (mismatched types int and string): 193 + ./in.cue:73:15 194 + ./in.cue:76:8 195 + ./in.cue:76:15 196 + byKind.scalarConstraints.out: conflicting values 5 and false (mismatched types int and bool): 197 + ./in.cue:73:27 198 + ./in.cue:76:8 199 + ./in.cue:76:15 200 + byKind.scalarConstraints.out: conflicting values 5 and null (mismatched types int and null): 201 + ./in.cue:73:20 202 + ./in.cue:76:8 203 + ./in.cue:76:15 204 + noKind.manyScalars.out: 3 errors in empty disjunction: 205 + noKind.manyScalars.out: conflicting values 1 and 123: 206 + ./in.cue:20:9 207 + ./in.cue:23:8 208 + ./in.cue:23:15 209 + noKind.manyScalars.out: conflicting values 2 and 123: 210 + ./in.cue:20:13 211 + ./in.cue:23:8 212 + ./in.cue:23:15 213 + noKind.manyScalars.out: conflicting values 3 and 123: 214 + ./in.cue:20:17 215 + ./in.cue:23:8 216 + ./in.cue:23:15 217 + noKind.manyWithStructEmbed.out: 3 errors in empty disjunction: 218 + noKind.manyWithStructEmbed.out: conflicting values 123 and string (mismatched types int and string): 219 + ./in.cue:8:42 220 + ./in.cue:11:8 221 + ./in.cue:11:15 222 + noKind.zeroScalars.out: 3 errors in empty disjunction: 223 + noKind.zeroScalars.out: conflicting values true and int (mismatched types bool and int): 224 + ./in.cue:26:9 225 + ./in.cue:29:8 226 + ./in.cue:29:15 227 + noKind.zeroScalars.out: conflicting values true and null (mismatched types bool and null): 228 + ./in.cue:26:24 229 + ./in.cue:29:8 230 + ./in.cue:29:15 231 + noKind.zeroScalars.out: conflicting values true and string (mismatched types bool and string): 232 + ./in.cue:26:15 233 + ./in.cue:29:8 234 + ./in.cue:29:15 235 + noKind.manyWithStructEmbed.out: invalid value 123 (out of bound <10): 236 + ./in.cue:8:10 237 + ./in.cue:11:15 238 + noKind.manyWithStructEmbed.out: invalid value 123 (out of bound >200): 239 + ./in.cue:8:35 240 + ./in.cue:11:15 241 + byKind.scalarConstraints.out: invalid value 5 (out of bound >10): 242 + ./in.cue:73:9 243 + ./in.cue:76:15 244 + 245 + Result: 246 + (_|_){ 247 + // [eval] 248 + noKind: (_|_){ 249 + // [eval] 250 + manyWithStructEmbed: (_|_){ 251 + // [eval] 252 + #Def: ((string|number)){ |((number){ 253 + <10 254 + _hidden: (string){ "field" } 255 + }, (number){ >200 }, (string){ string }) } 256 + out: (_|_){ 257 + // [eval] noKind.manyWithStructEmbed.out: 3 errors in empty disjunction: 258 + // noKind.manyWithStructEmbed.out: conflicting values 123 and string (mismatched types int and string): 259 + // ./in.cue:8:42 260 + // ./in.cue:11:8 261 + // ./in.cue:11:15 262 + // noKind.manyWithStructEmbed.out: invalid value 123 (out of bound <10): 263 + // ./in.cue:8:10 264 + // ./in.cue:11:15 265 + // noKind.manyWithStructEmbed.out: invalid value 123 (out of bound >200): 266 + // ./in.cue:8:35 267 + // ./in.cue:11:15 268 + } 269 + } 270 + manyStructsEmpty: (struct){ 271 + #Def: ((string|struct)){ |((#struct){ 272 + f1!: (int){ int } 273 + }, (#struct){ 274 + f2!: (int){ int } 275 + }, (string){ string }) } 276 + out: (#struct){ |((#struct){ 277 + f1!: (int){ int } 278 + }, (#struct){ 279 + f2!: (int){ int } 280 + }) } 281 + } 282 + manyScalars: (_|_){ 283 + // [eval] 284 + #Def: (int){ |((int){ 1 }, (int){ 2 }, (int){ 3 }) } 285 + out: (_|_){ 286 + // [eval] noKind.manyScalars.out: 3 errors in empty disjunction: 287 + // noKind.manyScalars.out: conflicting values 1 and 123: 288 + // ./in.cue:20:9 289 + // ./in.cue:23:8 290 + // ./in.cue:23:15 291 + // noKind.manyScalars.out: conflicting values 2 and 123: 292 + // ./in.cue:20:13 293 + // ./in.cue:23:8 294 + // ./in.cue:23:15 295 + // noKind.manyScalars.out: conflicting values 3 and 123: 296 + // ./in.cue:20:17 297 + // ./in.cue:23:8 298 + // ./in.cue:23:15 299 + } 300 + } 301 + zeroScalars: (_|_){ 302 + // [eval] 303 + #Def: ((null|int|string)){ |((int){ int }, (string){ string }, (null){ null }) } 304 + out: (_|_){ 305 + // [eval] noKind.zeroScalars.out: 3 errors in empty disjunction: 306 + // noKind.zeroScalars.out: conflicting values true and int (mismatched types bool and int): 307 + // ./in.cue:26:9 308 + // ./in.cue:29:8 309 + // ./in.cue:29:15 310 + // noKind.zeroScalars.out: conflicting values true and null (mismatched types bool and null): 311 + // ./in.cue:26:24 312 + // ./in.cue:29:8 313 + // ./in.cue:29:15 314 + // noKind.zeroScalars.out: conflicting values true and string (mismatched types bool and string): 315 + // ./in.cue:26:15 316 + // ./in.cue:29:8 317 + // ./in.cue:29:15 318 + } 319 + } 320 + } 321 + byKind: (_|_){ 322 + // [eval] 323 + nullableStructRegular: (_|_){ 324 + // [eval] 325 + #Def1: (#struct){ 326 + f1: ((null|struct)){ |((null){ null }, (#struct){ 327 + f2: ((null|struct)){ |((null){ null }, (#struct){ 328 + f3: ((null|int)){ |((null){ null }, (int){ int }) } 329 + }) } 330 + }) } 331 + } 332 + #Def2: (#struct){ 333 + f2: ((null|struct)){ |((null){ null }, (#struct){ 334 + f3: ((null|int)){ |((null){ null }, (int){ int }) } 335 + }) } 336 + } 337 + #Def3: (#struct){ 338 + f3: ((null|int)){ |((null){ null }, (int){ int }) } 339 + } 340 + out: (_|_){ 341 + // [eval] 342 + f1: (_|_){ 343 + // [eval] byKind.nullableStructRegular.out.f1: 6 errors in empty disjunction: 344 + // byKind.nullableStructRegular.out.f1: conflicting values null and {f2:{f3:"not an int"}} (mismatched types null and struct): 345 + // ./in.cue:37:15 346 + // ./in.cue:42:8 347 + // ./in.cue:42:21 348 + // byKind.nullableStructRegular.out.f1.f2: 4 errors in empty disjunction: 349 + // byKind.nullableStructRegular.out.f1.f2: conflicting values null and {f3:"not an int"} (mismatched types null and struct): 350 + // ./in.cue:37:22 351 + // ./in.cue:38:15 352 + // ./in.cue:42:8 353 + // ./in.cue:42:25 354 + // byKind.nullableStructRegular.out.f1.f2.f3: 2 errors in empty disjunction: 355 + // byKind.nullableStructRegular.out.f1.f2.f3: conflicting values "not an int" and int (mismatched types string and int): 356 + // ./in.cue:37:22 357 + // ./in.cue:38:22 358 + // ./in.cue:39:22 359 + // ./in.cue:42:8 360 + // ./in.cue:42:29 361 + // byKind.nullableStructRegular.out.f1.f2.f3: conflicting values "not an int" and null (mismatched types string and null): 362 + // ./in.cue:37:22 363 + // ./in.cue:38:22 364 + // ./in.cue:39:15 365 + // ./in.cue:42:8 366 + // ./in.cue:42:29 367 + f2: (struct){ 368 + f3: (string){ "not an int" } 369 + } 370 + } 371 + } 372 + } 373 + nullableStructRequired: (_|_){ 374 + // [eval] 375 + #Def1: (#struct){ 376 + f1!: ((null|struct)){ |((null){ null }, (#struct){ 377 + f2!: ((null|struct)){ |((null){ null }, (#struct){ 378 + f3!: ((null|int)){ |((null){ null }, (int){ int }) } 379 + }) } 380 + }) } 381 + } 382 + #Def2: (#struct){ 383 + f2!: ((null|struct)){ |((null){ null }, (#struct){ 384 + f3!: ((null|int)){ |((null){ null }, (int){ int }) } 385 + }) } 386 + } 387 + #Def3: (#struct){ 388 + f3!: ((null|int)){ |((null){ null }, (int){ int }) } 389 + } 390 + out: (_|_){ 391 + // [eval] 392 + f1: (_|_){ 393 + // [eval] byKind.nullableStructRequired.out.f1: 6 errors in empty disjunction: 394 + // byKind.nullableStructRequired.out.f1: conflicting values null and {f2:{f3:"not an int"}} (mismatched types null and struct): 395 + // ./in.cue:46:16 396 + // ./in.cue:51:8 397 + // ./in.cue:51:21 398 + // byKind.nullableStructRequired.out.f1.f2: 4 errors in empty disjunction: 399 + // byKind.nullableStructRequired.out.f1.f2: conflicting values null and {f3:"not an int"} (mismatched types null and struct): 400 + // ./in.cue:46:23 401 + // ./in.cue:47:16 402 + // ./in.cue:51:8 403 + // ./in.cue:51:25 404 + // byKind.nullableStructRequired.out.f1.f2.f3: 2 errors in empty disjunction: 405 + // byKind.nullableStructRequired.out.f1.f2.f3: conflicting values "not an int" and int (mismatched types string and int): 406 + // ./in.cue:46:23 407 + // ./in.cue:47:23 408 + // ./in.cue:48:23 409 + // ./in.cue:51:8 410 + // ./in.cue:51:29 411 + // byKind.nullableStructRequired.out.f1.f2.f3: conflicting values "not an int" and null (mismatched types string and null): 412 + // ./in.cue:46:23 413 + // ./in.cue:47:23 414 + // ./in.cue:48:16 415 + // ./in.cue:51:8 416 + // ./in.cue:51:29 417 + f2: (struct){ 418 + f3: (string){ "not an int" } 419 + } 420 + } 421 + } 422 + } 423 + nullableStructOptional: (_|_){ 424 + // [eval] 425 + #Def1: (#struct){ 426 + f1?: ((null|struct)){ |((null){ null }, (#struct){ 427 + f2?: ((null|struct)){ |((null){ null }, (#struct){ 428 + f3?: ((null|int)){ |((null){ null }, (int){ int }) } 429 + }) } 430 + }) } 431 + } 432 + #Def2: (#struct){ 433 + f2?: ((null|struct)){ |((null){ null }, (#struct){ 434 + f3?: ((null|int)){ |((null){ null }, (int){ int }) } 435 + }) } 436 + } 437 + #Def3: (#struct){ 438 + f3?: ((null|int)){ |((null){ null }, (int){ int }) } 439 + } 440 + out: (_|_){ 441 + // [eval] 442 + f1: (_|_){ 443 + // [eval] byKind.nullableStructOptional.out.f1: 6 errors in empty disjunction: 444 + // byKind.nullableStructOptional.out.f1: conflicting values null and {f2:{f3:"not an int"}} (mismatched types null and struct): 445 + // ./in.cue:55:16 446 + // ./in.cue:60:8 447 + // ./in.cue:60:21 448 + // byKind.nullableStructOptional.out.f1.f2: 4 errors in empty disjunction: 449 + // byKind.nullableStructOptional.out.f1.f2: conflicting values null and {f3:"not an int"} (mismatched types null and struct): 450 + // ./in.cue:55:23 451 + // ./in.cue:56:16 452 + // ./in.cue:60:8 453 + // ./in.cue:60:25 454 + // byKind.nullableStructOptional.out.f1.f2.f3: 2 errors in empty disjunction: 455 + // byKind.nullableStructOptional.out.f1.f2.f3: conflicting values "not an int" and int (mismatched types string and int): 456 + // ./in.cue:55:23 457 + // ./in.cue:56:23 458 + // ./in.cue:57:23 459 + // ./in.cue:60:8 460 + // ./in.cue:60:29 461 + // byKind.nullableStructOptional.out.f1.f2.f3: conflicting values "not an int" and null (mismatched types string and null): 462 + // ./in.cue:55:23 463 + // ./in.cue:56:23 464 + // ./in.cue:57:16 465 + // ./in.cue:60:8 466 + // ./in.cue:60:29 467 + f2: (struct){ 468 + f3: (string){ "not an int" } 469 + } 470 + } 471 + } 472 + } 473 + nullableList: (_|_){ 474 + // [eval] 475 + #Def1: (list){ 476 + } 477 + #Def2: (list){ 478 + } 479 + #Def3: (list){ 480 + } 481 + out: (_|_){ 482 + // [eval] 483 + 0: (_|_){ 484 + // [eval] byKind.nullableList.out.0: 6 errors in empty disjunction: 485 + // byKind.nullableList.out.0: conflicting values [["not an int"]] and null (mismatched types list and null): 486 + // ./in.cue:64:14 487 + // ./in.cue:69:8 488 + // ./in.cue:69:17 489 + // byKind.nullableList.out.0.0: 4 errors in empty disjunction: 490 + // byKind.nullableList.out.0.0: conflicting values ["not an int"] and null (mismatched types list and null): 491 + // ./in.cue:64:21 492 + // ./in.cue:65:14 493 + // ./in.cue:69:8 494 + // ./in.cue:69:18 495 + // byKind.nullableList.out.0.0.0: 2 errors in empty disjunction: 496 + // byKind.nullableList.out.0.0.0: conflicting values "not an int" and int (mismatched types string and int): 497 + // ./in.cue:64:21 498 + // ./in.cue:65:21 499 + // ./in.cue:66:21 500 + // ./in.cue:69:8 501 + // ./in.cue:69:19 502 + // byKind.nullableList.out.0.0.0: conflicting values "not an int" and null (mismatched types string and null): 503 + // ./in.cue:64:21 504 + // ./in.cue:65:21 505 + // ./in.cue:66:14 506 + // ./in.cue:69:8 507 + // ./in.cue:69:19 508 + 0: (list){ list } 509 + } 510 + } 511 + } 512 + scalarConstraints: (_|_){ 513 + // [eval] 514 + #Def: ((null|bool|string|number)){ |((number){ >10 }, (string){ "" }, (null){ null }, (bool){ false }) } 515 + out: (_|_){ 516 + // [eval] byKind.scalarConstraints.out: 4 errors in empty disjunction: 517 + // byKind.scalarConstraints.out: conflicting values 5 and "" (mismatched types int and string): 518 + // ./in.cue:73:15 519 + // ./in.cue:76:8 520 + // ./in.cue:76:15 521 + // byKind.scalarConstraints.out: conflicting values 5 and false (mismatched types int and bool): 522 + // ./in.cue:73:27 523 + // ./in.cue:76:8 524 + // ./in.cue:76:15 525 + // byKind.scalarConstraints.out: conflicting values 5 and null (mismatched types int and null): 526 + // ./in.cue:73:20 527 + // ./in.cue:76:8 528 + // ./in.cue:76:15 529 + // byKind.scalarConstraints.out: invalid value 5 (out of bound >10): 530 + // ./in.cue:73:9 531 + // ./in.cue:76:15 532 + } 533 + } 534 + } 535 + } 536 + -- out/compile -- 537 + --- in.cue 538 + { 539 + noKind: { 540 + manyWithStructEmbed: { 541 + #Def: ({ 542 + <10 543 + _hidden: "field" 544 + }|>200|string) 545 + out: (〈0;#Def〉 & 123) 546 + } 547 + manyStructsEmpty: { 548 + #Def: ({ 549 + f1!: int 550 + }|{ 551 + f2!: int 552 + }|string) 553 + out: (〈0;#Def〉 & {}) 554 + } 555 + manyScalars: { 556 + #Def: (1|2|3) 557 + out: (〈0;#Def〉 & 123) 558 + } 559 + zeroScalars: { 560 + #Def: (int|string|null) 561 + out: (〈0;#Def〉 & true) 562 + } 563 + } 564 + byKind: { 565 + nullableStructRegular: { 566 + #Def1: { 567 + f1: (null|〈1;#Def2〉) 568 + } 569 + #Def2: { 570 + f2: (null|〈1;#Def3〉) 571 + } 572 + #Def3: { 573 + f3: (null|int) 574 + } 575 + out: (〈0;#Def1〉 & { 576 + f1: { 577 + f2: { 578 + f3: "not an int" 579 + } 580 + } 581 + }) 582 + } 583 + nullableStructRequired: { 584 + #Def1: { 585 + f1!: (null|〈1;#Def2〉) 586 + } 587 + #Def2: { 588 + f2!: (null|〈1;#Def3〉) 589 + } 590 + #Def3: { 591 + f3!: (null|int) 592 + } 593 + out: (〈0;#Def1〉 & { 594 + f1: { 595 + f2: { 596 + f3: "not an int" 597 + } 598 + } 599 + }) 600 + } 601 + nullableStructOptional: { 602 + #Def1: { 603 + f1?: (null|〈1;#Def2〉) 604 + } 605 + #Def2: { 606 + f2?: (null|〈1;#Def3〉) 607 + } 608 + #Def3: { 609 + f3?: (null|int) 610 + } 611 + out: (〈0;#Def1〉 & { 612 + f1: { 613 + f2: { 614 + f3: "not an int" 615 + } 616 + } 617 + }) 618 + } 619 + nullableList: { 620 + #Def1: [ 621 + ...(null|〈1;#Def2〉), 622 + ] 623 + #Def2: [ 624 + ...(null|〈1;#Def3〉), 625 + ] 626 + #Def3: [ 627 + ...(null|int), 628 + ] 629 + out: (〈0;#Def1〉 & [ 630 + [ 631 + [ 632 + "not an int", 633 + ], 634 + ], 635 + ]) 636 + } 637 + scalarConstraints: { 638 + #Def: (>10|""|null|false) 639 + out: (〈0;#Def〉 & 5) 640 + } 641 + } 642 + }