github.com/solo-io/cue@v0.4.7/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 --
    78  Errors:
    79  e: conflicting values 4 and [] (mismatched types int and list):
    80      ./in.cue:4:8
    81      ./in.cue:4:13
    82  e2: invalid list index d (type string):
    83      ./in.cue:5:12
    84  e3: invalid index -1 (index must be non-negative):
    85      ./in.cue:6:8
    86      ./in.cue:6:12
    87  e4.3: invalid value 8 (out of bound <=5):
    88      ./in.cue:7:24
    89      ./in.cue:7:41
    90  e5.3: invalid value 8 (out of bound <=5):
    91      ./in.cue:8:39
    92      ./in.cue:8:18
    93  
    94  Result:
    95  (_|_){
    96    // [eval]
    97    list: (#list){
    98      0: (int){ 1 }
    99      1: (int){ 2 }
   100      2: (int){ 3 }
   101    }
   102    index: (int){ 2 }
   103    unify: (#list){
   104      0: (int){ 1 }
   105      1: (int){ 2 }
   106      2: (int){ 3 }
   107    }
   108    e: (_|_){
   109      // [eval] e: conflicting values 4 and [] (mismatched types int and list):
   110      //     ./in.cue:4:8
   111      //     ./in.cue:4:13
   112    }
   113    e2: (_|_){
   114      // [eval] e2: invalid list index d (type string):
   115      //     ./in.cue:5:12
   116    }
   117    e3: (_|_){
   118      // [eval] e3: invalid index -1 (index must be non-negative):
   119      //     ./in.cue:6:8
   120      //     ./in.cue:6:12
   121    }
   122    e4: (_|_){
   123      // [eval]
   124      0: (int){ 1 }
   125      1: (int){ 2 }
   126      2: (int){ 4 }
   127      3: (_|_){
   128        // [eval] e4.3: invalid value 8 (out of bound <=5):
   129        //     ./in.cue:7:24
   130        //     ./in.cue:7:41
   131      }
   132    }
   133    e5: (_|_){
   134      // [eval]
   135      0: (int){ 1 }
   136      1: (int){ 2 }
   137      2: (int){ 4 }
   138      3: (_|_){
   139        // [eval] e5.3: invalid value 8 (out of bound <=5):
   140        //     ./in.cue:8:39
   141        //     ./in.cue:8:18
   142      }
   143    }
   144  }