cuelang.org/go@v0.10.1/cue/testdata/resolve/011_bounds.txtar (about)

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