cuelang.org/go@v0.13.0/cue/testdata/resolve/011_bounds.txtar (about) 1 #name: bounds 2 #evalPartial 3 -- in.cue -- 4 i1: >1 & 5 5 i2: (>=0 & <=10) & 5 6 i3: !=null & [] 7 i4: !=2 & !=4 8 9 s1: >=0 & <=10 & !=1 // no simplification 10 s2: >=0 & <=10 & !=11 // >=0 & <=10 11 s3: >5 & !=5 // >5 12 s4: <10 & !=10 // <10 13 s5: !=2 & !=2 14 15 // TODO: could change inequality 16 s6: !=2 & >=2 17 s7: >=2 & !=2 18 19 s8: !=5 & >5 20 21 s10: >=0 & <=10 & <12 & >1 // >1 & <=10 22 s11: >0 & >=0 & <=12 & <12 // >0 & <12 23 24 s20: >=10 & <=10 // 10 25 26 s22: >5 & <=6 // no simplification 27 s22a: >5 & (<=6 & int) // 6 28 s22b: (int & >5) & <=6 // 6 29 s22c: >=5 & (<6 & int) // 5 30 s22d: (int & >=5) & <6 // 5 31 s22e: (>=5 & <6) & int // 5 32 s22f: int & (>=5 & <6) // 5 33 34 s23: >0 & <2 // no simplification 35 s23a: (>0 & <2) & int // int & 1 36 s23b: int & (>0 & <2) // int & 1 37 s23c: (int & >0) & <2 // int & 1 38 s23d: >0 & (int & <2) // int & 1 39 s23e: >0.0 & <2.0 // no simplification 40 41 s30: >0 & int 42 43 floats: { 44 [string]: float 45 f1: <10.0 & <=5.0 46 f2: <=10.0 & <5.0 47 f3: <1.1 & <=1.1 48 f4: <=1.1 & <=1.1 49 f5: >1.1 & >=1.1 50 f6: >=1.1 & >1.1 51 f7: >=1.1 & <=1.1 52 53 issue1310: >=2.1 & <=1.0 54 fe2: >2.1 & <=2.1 55 56 fe3: float & >2 & <=3 57 } 58 59 e1: null & !=null 60 e2: !=null & null 61 e3: >1 & 1 62 e4: <0 & 0 63 e5: >1 & <0 64 e6: >11 & <11 65 e7: >=11 & <11 66 e8: >11 & <=11 67 e9: >"a" & <1 68 -- out/def -- 69 i1: 5 70 i2: 5 71 i3: [] 72 i4: !=2 & !=4 73 s1: >=0 & <=10 & !=1 74 s2: >=0 & <=10 75 s3: >5 76 s4: <10 77 s5: !=2 78 79 // TODO: could change inequality 80 s6: !=2 81 s7: !=2 82 s8: >5 83 s10: >1 & <=10 84 s11: >0 & <12 85 s20: 10 86 s22: >5 & <=6 87 s22a: 6 88 s22b: 6 89 s22c: 5 90 s22d: 5 91 s22e: 5 92 s22f: 5 93 s23: >0 & <2 94 s23a: 1 95 s23b: 1 96 s23c: 1 97 s23d: 1 98 s23e: >0.0 & <2.0 99 s30: >0 100 e1: _|_ // invalid value null (excluded by !=null) 101 e2: _|_ // invalid value null (excluded by !=null) 102 e3: _|_ // invalid value 1 (out of bound >1) 103 e4: _|_ // invalid value 0 (out of bound <0) 104 e5: _|_ // conflicting bounds >1 and <0 105 e6: _|_ // conflicting bounds >11 and <11 106 e7: _|_ // conflicting bounds >=11 and <11 107 e8: _|_ // conflicting bounds >11 and <=11 108 e9: _|_ // conflicting values >"a" and <1 (mismatched types string and number) 109 -- out/legacy-debug -- 110 <0>{i1: 5, i2: 5, i3: [], i4: (!=2 & !=4), s1: (>=0 & <=10 & !=1), s2: (>=0 & <=10), s3: >5, s4: <10, s5: !=2, s6: (!=2 & >=2), s7: (>=2 & !=2), s8: >5, s10: (<=10 & >1), s11: (>0 & <12), s20: 10, s22: (>5 & <=6), s22a: 6, s22b: 6, s22c: 5, s22d: 5, s22e: 5, s22f: 5, s23: (>0 & <2), s23a: 1, s23b: 1, s23c: 1, s23d: 1, s23e: (>0.0 & <2.0), s30: int & >0, e1: _|_((!=null & null):invalid value null (excluded by !=null)), e2: _|_((!=null & null):invalid value null (excluded by !=null)), e3: _|_((>1 & 1):invalid value 1 (out of bound >1)), e4: _|_((<0 & 0):invalid value 0 (out of bound <0)), e5: _|_(conflicting bounds >1 and <0), e6: _|_(conflicting bounds >11 and <11), e7: _|_(conflicting bounds >=11 and <11), e8: _|_(conflicting bounds >11 and <=11), e9: _|_((>"a" & <1):conflicting values >"a" and <1 (mismatched types string and number))} 111 -- out/compile -- 112 --- in.cue 113 { 114 i1: (>1 & 5) 115 i2: ((>=0 & <=10) & 5) 116 i3: (!=null & []) 117 i4: (!=2 & !=4) 118 s1: ((>=0 & <=10) & !=1) 119 s2: ((>=0 & <=10) & !=11) 120 s3: (>5 & !=5) 121 s4: (<10 & !=10) 122 s5: (!=2 & !=2) 123 s6: (!=2 & >=2) 124 s7: (>=2 & !=2) 125 s8: (!=5 & >5) 126 s10: (((>=0 & <=10) & <12) & >1) 127 s11: (((>0 & >=0) & <=12) & <12) 128 s20: (>=10 & <=10) 129 s22: (>5 & <=6) 130 s22a: (>5 & (<=6 & int)) 131 s22b: ((int & >5) & <=6) 132 s22c: (>=5 & (<6 & int)) 133 s22d: ((int & >=5) & <6) 134 s22e: ((>=5 & <6) & int) 135 s22f: (int & (>=5 & <6)) 136 s23: (>0 & <2) 137 s23a: ((>0 & <2) & int) 138 s23b: (int & (>0 & <2)) 139 s23c: ((int & >0) & <2) 140 s23d: (>0 & (int & <2)) 141 s23e: (>0.0 & <2.0) 142 s30: (>0 & int) 143 floats: { 144 [string]: float 145 f1: (<10.0 & <=5.0) 146 f2: (<=10.0 & <5.0) 147 f3: (<1.1 & <=1.1) 148 f4: (<=1.1 & <=1.1) 149 f5: (>1.1 & >=1.1) 150 f6: (>=1.1 & >1.1) 151 f7: (>=1.1 & <=1.1) 152 issue1310: (>=2.1 & <=1.0) 153 fe2: (>2.1 & <=2.1) 154 fe3: ((float & >2) & <=3) 155 } 156 e1: (null & !=null) 157 e2: (!=null & null) 158 e3: (>1 & 1) 159 e4: (<0 & 0) 160 e5: (>1 & <0) 161 e6: (>11 & <11) 162 e7: (>=11 & <11) 163 e8: (>11 & <=11) 164 e9: (>"a" & <1) 165 } 166 -- out/eval/stats -- 167 Leaks: 0 168 Freed: 50 169 Reused: 47 170 Allocs: 3 171 Retain: 0 172 173 Unifications: 50 174 Conjuncts: 126 175 Disjuncts: 50 176 -- out/evalalpha -- 177 Errors: 178 e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 179 ./in.cue:56:5 180 ./in.cue:56:12 181 e2: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 182 ./in.cue:57:5 183 ./in.cue:57:14 184 e9: conflicting values >"a" and <1 (mismatched types string and number): 185 ./in.cue:64:5 186 ./in.cue:64:12 187 floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 188 ./in.cue:50:21 189 ./in.cue:50:13 190 floats.fe2: incompatible number bounds <=2.1 and >2.1: 191 ./in.cue:51:20 192 ./in.cue:51:13 193 e3: invalid value 1 (out of bound >1): 194 ./in.cue:58:5 195 ./in.cue:58:10 196 e4: invalid value 0 (out of bound <0): 197 ./in.cue:59:5 198 ./in.cue:59:10 199 e5: incompatible number bounds <0 and >1: 200 ./in.cue:60:10 201 ./in.cue:60:5 202 e6: incompatible number bounds <11 and >11: 203 ./in.cue:61:11 204 ./in.cue:61:5 205 e7: incompatible number bounds <11 and >=11: 206 ./in.cue:62:12 207 ./in.cue:62:5 208 e8: incompatible number bounds <=11 and >11: 209 ./in.cue:63:11 210 ./in.cue:63:5 211 212 Result: 213 (_|_){ 214 // [eval] 215 i1: (int){ 5 } 216 i2: (int){ 5 } 217 i3: (#list){ 218 } 219 i4: (number){ &(!=2, !=4) } 220 s1: (number){ &(>=0, <=10, !=1) } 221 s2: (number){ &(>=0, <=10) } 222 s3: (number){ >5 } 223 s4: (number){ <10 } 224 s5: (number){ !=2 } 225 s6: (number){ &(>=2, !=2) } 226 s7: (number){ &(>=2, !=2) } 227 s8: (number){ >5 } 228 s10: (number){ &(>1, <=10) } 229 s11: (number){ &(>0, <12) } 230 s20: (number){ 10 } 231 s22: (number){ &(>5, <=6) } 232 s22a: (int){ 6 } 233 s22b: (int){ 6 } 234 s22c: (int){ 5 } 235 s22d: (int){ 5 } 236 s22e: (int){ 5 } 237 s22f: (int){ 5 } 238 s23: (number){ &(>0, <2) } 239 s23a: (int){ 1 } 240 s23b: (int){ 1 } 241 s23c: (int){ 1 } 242 s23d: (int){ 1 } 243 s23e: (number){ &(>0.0, <2.0) } 244 s30: (int){ &(>0, int) } 245 floats: (_|_){ 246 // [eval] 247 f1: (float){ &(<=5.0, float) } 248 f2: (float){ &(<5.0, float) } 249 f3: (float){ &(<1.1, float) } 250 f4: (float){ &(<=1.1, float) } 251 f5: (float){ &(>1.1, float) } 252 f6: (float){ &(>1.1, float) } 253 f7: (float){ 1.1 } 254 issue1310: (_|_){ 255 // [eval] floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 256 // ./in.cue:50:21 257 // ./in.cue:50:13 258 } 259 fe2: (_|_){ 260 // [eval] floats.fe2: incompatible number bounds <=2.1 and >2.1: 261 // ./in.cue:51:20 262 // ./in.cue:51:13 263 } 264 fe3: (float){ &(>2, <=3, float) } 265 } 266 e1: (_|_){ 267 // [eval] e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 268 // ./in.cue:56:5 269 // ./in.cue:56:12 270 } 271 e2: (_|_){ 272 // [eval] e2: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 273 // ./in.cue:57:5 274 // ./in.cue:57:14 275 } 276 e3: (_|_){ 277 // [eval] e3: invalid value 1 (out of bound >1): 278 // ./in.cue:58:5 279 // ./in.cue:58:10 280 } 281 e4: (_|_){ 282 // [eval] e4: invalid value 0 (out of bound <0): 283 // ./in.cue:59:5 284 // ./in.cue:59:10 285 } 286 e5: (_|_){ 287 // [eval] e5: incompatible number bounds <0 and >1: 288 // ./in.cue:60:10 289 // ./in.cue:60:5 290 } 291 e6: (_|_){ 292 // [eval] e6: incompatible number bounds <11 and >11: 293 // ./in.cue:61:11 294 // ./in.cue:61:5 295 } 296 e7: (_|_){ 297 // [eval] e7: incompatible number bounds <11 and >=11: 298 // ./in.cue:62:12 299 // ./in.cue:62:5 300 } 301 e8: (_|_){ 302 // [eval] e8: incompatible number bounds <=11 and >11: 303 // ./in.cue:63:11 304 // ./in.cue:63:5 305 } 306 e9: (_|_){ 307 // [eval] e9: conflicting values >"a" and <1 (mismatched types string and number): 308 // ./in.cue:64:5 309 // ./in.cue:64:12 310 } 311 } 312 -- diff/-out/evalalpha<==>+out/eval -- 313 diff old new 314 --- old 315 +++ new 316 @@ -2,30 +2,18 @@ 317 e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 318 ./in.cue:56:5 319 ./in.cue:56:12 320 -e2: conflicting values !=null and null (mismatched types (bool|string|bytes|func|list|struct|number) and null): 321 +e2: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 322 ./in.cue:57:5 323 ./in.cue:57:14 324 -e5: incompatible number bounds <0 and >1: 325 - ./in.cue:60:5 326 - ./in.cue:60:10 327 -e6: incompatible number bounds <11 and >11: 328 - ./in.cue:61:5 329 - ./in.cue:61:11 330 -e7: incompatible number bounds <11 and >=11: 331 - ./in.cue:62:5 332 - ./in.cue:62:12 333 -e8: incompatible number bounds <=11 and >11: 334 - ./in.cue:63:5 335 - ./in.cue:63:11 336 e9: conflicting values >"a" and <1 (mismatched types string and number): 337 ./in.cue:64:5 338 ./in.cue:64:12 339 -floats.fe2: incompatible number bounds <=2.1 and >2.1: 340 - ./in.cue:51:13 341 - ./in.cue:51:20 342 floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 343 - ./in.cue:50:13 344 ./in.cue:50:21 345 + ./in.cue:50:13 346 +floats.fe2: incompatible number bounds <=2.1 and >2.1: 347 + ./in.cue:51:20 348 + ./in.cue:51:13 349 e3: invalid value 1 (out of bound >1): 350 ./in.cue:58:5 351 ./in.cue:58:10 352 @@ -32,6 +20,18 @@ 353 e4: invalid value 0 (out of bound <0): 354 ./in.cue:59:5 355 ./in.cue:59:10 356 +e5: incompatible number bounds <0 and >1: 357 + ./in.cue:60:10 358 + ./in.cue:60:5 359 +e6: incompatible number bounds <11 and >11: 360 + ./in.cue:61:11 361 + ./in.cue:61:5 362 +e7: incompatible number bounds <11 and >=11: 363 + ./in.cue:62:12 364 + ./in.cue:62:5 365 +e8: incompatible number bounds <=11 and >11: 366 + ./in.cue:63:11 367 + ./in.cue:63:5 368 369 Result: 370 (_|_){ 371 @@ -74,16 +74,16 @@ 372 f4: (float){ &(<=1.1, float) } 373 f5: (float){ &(>1.1, float) } 374 f6: (float){ &(>1.1, float) } 375 - f7: (number){ 1.1 } 376 + f7: (float){ 1.1 } 377 issue1310: (_|_){ 378 // [eval] floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 379 - // ./in.cue:50:13 380 // ./in.cue:50:21 381 + // ./in.cue:50:13 382 } 383 fe2: (_|_){ 384 // [eval] floats.fe2: incompatible number bounds <=2.1 and >2.1: 385 - // ./in.cue:51:13 386 // ./in.cue:51:20 387 + // ./in.cue:51:13 388 } 389 fe3: (float){ &(>2, <=3, float) } 390 } 391 @@ -93,7 +93,7 @@ 392 // ./in.cue:56:12 393 } 394 e2: (_|_){ 395 - // [eval] e2: conflicting values !=null and null (mismatched types (bool|string|bytes|func|list|struct|number) and null): 396 + // [eval] e2: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 397 // ./in.cue:57:5 398 // ./in.cue:57:14 399 } 400 @@ -109,23 +109,23 @@ 401 } 402 e5: (_|_){ 403 // [eval] e5: incompatible number bounds <0 and >1: 404 - // ./in.cue:60:5 405 // ./in.cue:60:10 406 + // ./in.cue:60:5 407 } 408 e6: (_|_){ 409 // [eval] e6: incompatible number bounds <11 and >11: 410 - // ./in.cue:61:5 411 // ./in.cue:61:11 412 + // ./in.cue:61:5 413 } 414 e7: (_|_){ 415 // [eval] e7: incompatible number bounds <11 and >=11: 416 - // ./in.cue:62:5 417 // ./in.cue:62:12 418 + // ./in.cue:62:5 419 } 420 e8: (_|_){ 421 // [eval] e8: incompatible number bounds <=11 and >11: 422 - // ./in.cue:63:5 423 // ./in.cue:63:11 424 + // ./in.cue:63:5 425 } 426 e9: (_|_){ 427 // [eval] e9: conflicting values >"a" and <1 (mismatched types string and number): 428 -- diff/todo/p3 -- 429 Reordering 430 -- diff/explanation -- 431 f7 changed from number to float. This is a bug fix. 432 -- out/eval -- 433 Errors: 434 e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 435 ./in.cue:56:5 436 ./in.cue:56:12 437 e2: conflicting values !=null and null (mismatched types (bool|string|bytes|func|list|struct|number) and null): 438 ./in.cue:57:5 439 ./in.cue:57:14 440 e5: incompatible number bounds <0 and >1: 441 ./in.cue:60:5 442 ./in.cue:60:10 443 e6: incompatible number bounds <11 and >11: 444 ./in.cue:61:5 445 ./in.cue:61:11 446 e7: incompatible number bounds <11 and >=11: 447 ./in.cue:62:5 448 ./in.cue:62:12 449 e8: incompatible number bounds <=11 and >11: 450 ./in.cue:63:5 451 ./in.cue:63:11 452 e9: conflicting values >"a" and <1 (mismatched types string and number): 453 ./in.cue:64:5 454 ./in.cue:64:12 455 floats.fe2: incompatible number bounds <=2.1 and >2.1: 456 ./in.cue:51:13 457 ./in.cue:51:20 458 floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 459 ./in.cue:50:13 460 ./in.cue:50:21 461 e3: invalid value 1 (out of bound >1): 462 ./in.cue:58:5 463 ./in.cue:58:10 464 e4: invalid value 0 (out of bound <0): 465 ./in.cue:59:5 466 ./in.cue:59:10 467 468 Result: 469 (_|_){ 470 // [eval] 471 i1: (int){ 5 } 472 i2: (int){ 5 } 473 i3: (#list){ 474 } 475 i4: (number){ &(!=2, !=4) } 476 s1: (number){ &(>=0, <=10, !=1) } 477 s2: (number){ &(>=0, <=10) } 478 s3: (number){ >5 } 479 s4: (number){ <10 } 480 s5: (number){ !=2 } 481 s6: (number){ &(>=2, !=2) } 482 s7: (number){ &(>=2, !=2) } 483 s8: (number){ >5 } 484 s10: (number){ &(>1, <=10) } 485 s11: (number){ &(>0, <12) } 486 s20: (number){ 10 } 487 s22: (number){ &(>5, <=6) } 488 s22a: (int){ 6 } 489 s22b: (int){ 6 } 490 s22c: (int){ 5 } 491 s22d: (int){ 5 } 492 s22e: (int){ 5 } 493 s22f: (int){ 5 } 494 s23: (number){ &(>0, <2) } 495 s23a: (int){ 1 } 496 s23b: (int){ 1 } 497 s23c: (int){ 1 } 498 s23d: (int){ 1 } 499 s23e: (number){ &(>0.0, <2.0) } 500 s30: (int){ &(>0, int) } 501 floats: (_|_){ 502 // [eval] 503 f1: (float){ &(<=5.0, float) } 504 f2: (float){ &(<5.0, float) } 505 f3: (float){ &(<1.1, float) } 506 f4: (float){ &(<=1.1, float) } 507 f5: (float){ &(>1.1, float) } 508 f6: (float){ &(>1.1, float) } 509 f7: (number){ 1.1 } 510 issue1310: (_|_){ 511 // [eval] floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 512 // ./in.cue:50:13 513 // ./in.cue:50:21 514 } 515 fe2: (_|_){ 516 // [eval] floats.fe2: incompatible number bounds <=2.1 and >2.1: 517 // ./in.cue:51:13 518 // ./in.cue:51:20 519 } 520 fe3: (float){ &(>2, <=3, float) } 521 } 522 e1: (_|_){ 523 // [eval] e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 524 // ./in.cue:56:5 525 // ./in.cue:56:12 526 } 527 e2: (_|_){ 528 // [eval] e2: conflicting values !=null and null (mismatched types (bool|string|bytes|func|list|struct|number) and null): 529 // ./in.cue:57:5 530 // ./in.cue:57:14 531 } 532 e3: (_|_){ 533 // [eval] e3: invalid value 1 (out of bound >1): 534 // ./in.cue:58:5 535 // ./in.cue:58:10 536 } 537 e4: (_|_){ 538 // [eval] e4: invalid value 0 (out of bound <0): 539 // ./in.cue:59:5 540 // ./in.cue:59:10 541 } 542 e5: (_|_){ 543 // [eval] e5: incompatible number bounds <0 and >1: 544 // ./in.cue:60:5 545 // ./in.cue:60:10 546 } 547 e6: (_|_){ 548 // [eval] e6: incompatible number bounds <11 and >11: 549 // ./in.cue:61:5 550 // ./in.cue:61:11 551 } 552 e7: (_|_){ 553 // [eval] e7: incompatible number bounds <11 and >=11: 554 // ./in.cue:62:5 555 // ./in.cue:62:12 556 } 557 e8: (_|_){ 558 // [eval] e8: incompatible number bounds <=11 and >11: 559 // ./in.cue:63:5 560 // ./in.cue:63:11 561 } 562 e9: (_|_){ 563 // [eval] e9: conflicting values >"a" and <1 (mismatched types string and number): 564 // ./in.cue:64:5 565 // ./in.cue:64:12 566 } 567 }