cuelang.org/go@v0.10.1/cue/testdata/basicrewrite/010_lists.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: lists
     4  #evalPartial
     5  -- in.cue --
     6  list: [1, 2, 3]
     7  index: [1, 2, 3][1]
     8  unify: [1, 2, 3] & [_, 2, 3]
     9  e:     [] & 4
    10  e2:    [3]["d"]
    11  e3:    [3][-1]
    12  e4:    [1, 2, ...>=4 & <=5] & [1, 2, 4, 8]
    13  e5:    [1, 2, 4, 8] & [1, 2, ...>=4 & <=5]
    14  -- out/def --
    15  list: [1, 2, 3]
    16  index: 2
    17  unify: [1, 2, 3]
    18  e:  _|_ // conflicting values [] and 4 (mismatched types list and int)
    19  e2: _|_ // invalid list index "d" (type string)
    20  e3: _|_ // invalid list index -1 (index must be non-negative)
    21  e4: [1, 2, 4, _|_, // invalid value 8 (out of bound <=5)
    22  ]
    23  e5: [1, 2, 4, _|_, // invalid value 8 (out of bound <=5)
    24  ]
    25  -- out/legacy-debug --
    26  <0>{list: [1,2,3], index: 2, unify: [1,2,3], e: _|_(([] & 4):conflicting values [] and 4 (mismatched types list and int)), e2: _|_("d":invalid list index "d" (type string)), e3: _|_(-1:invalid list index -1 (index must be non-negative)), e4: [1,2,4,_|_((<=5 & 8):invalid value 8 (out of bound <=5))], e5: [1,2,4,_|_((<=5 & 8):invalid value 8 (out of bound <=5))]}
    27  -- out/compile --
    28  --- in.cue
    29  {
    30    list: [
    31      1,
    32      2,
    33      3,
    34    ]
    35    index: [
    36      1,
    37      2,
    38      3,
    39    ][1]
    40    unify: ([
    41      1,
    42      2,
    43      3,
    44    ] & [
    45      _,
    46      2,
    47      3,
    48    ])
    49    e: ([] & 4)
    50    e2: [
    51      3,
    52    ]["d"]
    53    e3: [
    54      3,
    55    ][-1]
    56    e4: ([
    57      1,
    58      2,
    59      ...(>=4 & <=5),
    60    ] & [
    61      1,
    62      2,
    63      4,
    64      8,
    65    ])
    66    e5: ([
    67      1,
    68      2,
    69      4,
    70      8,
    71    ] & [
    72      1,
    73      2,
    74      ...(>=4 & <=5),
    75    ])
    76  }
    77  -- out/eval/stats --
    78  Leaks:  4
    79  Freed:  23
    80  Reused: 20
    81  Allocs: 7
    82  Retain: 4
    83  
    84  Unifications: 27
    85  Conjuncts:    46
    86  Disjuncts:    26
    87  -- out/evalalpha --
    88  Errors:
    89  e: conflicting values 4 and [] (mismatched types int and list):
    90      ./in.cue:4:8
    91      ./in.cue:4:13
    92  e2: undefined field: d:
    93      ./in.cue:5:12
    94  e3: invalid index -1 (index must be non-negative):
    95      ./in.cue:6:8
    96      ./in.cue:6:12
    97  e4.3: invalid value 8 (out of bound <=5):
    98      ./in.cue:7:24
    99      ./in.cue:7:41
   100  e5.3: invalid value 8 (out of bound <=5):
   101      ./in.cue:8:39
   102      ./in.cue:8:18
   103  
   104  Result:
   105  (_|_){
   106    // [eval]
   107    list: (#list){
   108      0: (int){ 1 }
   109      1: (int){ 2 }
   110      2: (int){ 3 }
   111    }
   112    index: (int){ 2 }
   113    unify: (#list){
   114      0: (int){ 1 }
   115      1: (int){ 2 }
   116      2: (int){ 3 }
   117    }
   118    e: (_|_){
   119      // [eval] e: conflicting values 4 and [] (mismatched types int and list):
   120      //     ./in.cue:4:8
   121      //     ./in.cue:4:13
   122    }
   123    e2: (_|_){
   124      // [eval] e2: undefined field: d:
   125      //     ./in.cue:5:12
   126    }
   127    e3: (_|_){
   128      // [eval] e3: invalid index -1 (index must be non-negative):
   129      //     ./in.cue:6:8
   130      //     ./in.cue:6:12
   131    }
   132    e4: (_|_){
   133      // [eval]
   134      0: (int){ 1 }
   135      1: (int){ 2 }
   136      2: (int){ 4 }
   137      3: (_|_){
   138        // [eval] e4.3: invalid value 8 (out of bound <=5):
   139        //     ./in.cue:7:24
   140        //     ./in.cue:7:41
   141      }
   142    }
   143    e5: (_|_){
   144      // [eval]
   145      0: (int){ 1 }
   146      1: (int){ 2 }
   147      2: (int){ 4 }
   148      3: (_|_){
   149        // [eval] e5.3: invalid value 8 (out of bound <=5):
   150        //     ./in.cue:8:39
   151        //     ./in.cue:8:18
   152      }
   153    }
   154  }
   155  -- diff/-out/evalalpha<==>+out/eval --
   156  diff old new
   157  --- old
   158  +++ new
   159  @@ -2,7 +2,7 @@
   160   e: conflicting values 4 and [] (mismatched types int and list):
   161       ./in.cue:4:8
   162       ./in.cue:4:13
   163  -e2: invalid list index d (type string):
   164  +e2: undefined field: d:
   165       ./in.cue:5:12
   166   e3: invalid index -1 (index must be non-negative):
   167       ./in.cue:6:8
   168  @@ -34,7 +34,7 @@
   169       //     ./in.cue:4:13
   170     }
   171     e2: (_|_){
   172  -    // [eval] e2: invalid list index d (type string):
   173  +    // [eval] e2: undefined field: d:
   174       //     ./in.cue:5:12
   175     }
   176     e3: (_|_){
   177  -- diff/todo/p2 --
   178  error: more precise message
   179  -- out/eval --
   180  Errors:
   181  e: conflicting values 4 and [] (mismatched types int and list):
   182      ./in.cue:4:8
   183      ./in.cue:4:13
   184  e2: invalid list index d (type string):
   185      ./in.cue:5:12
   186  e3: invalid index -1 (index must be non-negative):
   187      ./in.cue:6:8
   188      ./in.cue:6:12
   189  e4.3: invalid value 8 (out of bound <=5):
   190      ./in.cue:7:24
   191      ./in.cue:7:41
   192  e5.3: invalid value 8 (out of bound <=5):
   193      ./in.cue:8:39
   194      ./in.cue:8:18
   195  
   196  Result:
   197  (_|_){
   198    // [eval]
   199    list: (#list){
   200      0: (int){ 1 }
   201      1: (int){ 2 }
   202      2: (int){ 3 }
   203    }
   204    index: (int){ 2 }
   205    unify: (#list){
   206      0: (int){ 1 }
   207      1: (int){ 2 }
   208      2: (int){ 3 }
   209    }
   210    e: (_|_){
   211      // [eval] e: conflicting values 4 and [] (mismatched types int and list):
   212      //     ./in.cue:4:8
   213      //     ./in.cue:4:13
   214    }
   215    e2: (_|_){
   216      // [eval] e2: invalid list index d (type string):
   217      //     ./in.cue:5:12
   218    }
   219    e3: (_|_){
   220      // [eval] e3: invalid index -1 (index must be non-negative):
   221      //     ./in.cue:6:8
   222      //     ./in.cue:6:12
   223    }
   224    e4: (_|_){
   225      // [eval]
   226      0: (int){ 1 }
   227      1: (int){ 2 }
   228      2: (int){ 4 }
   229      3: (_|_){
   230        // [eval] e4.3: invalid value 8 (out of bound <=5):
   231        //     ./in.cue:7:24
   232        //     ./in.cue:7:41
   233      }
   234    }
   235    e5: (_|_){
   236      // [eval]
   237      0: (int){ 1 }
   238      1: (int){ 2 }
   239      2: (int){ 4 }
   240      3: (_|_){
   241        // [eval] e5.3: invalid value 8 (out of bound <=5):
   242        //     ./in.cue:8:39
   243        //     ./in.cue:8:18
   244      }
   245    }
   246  }