...

Text file src/cuelang.org/go/cue/testdata/basicrewrite/010_lists.txtar

Documentation: cuelang.org/go/cue/testdata/basicrewrite

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: lists
     4#evalPartial
     5-- in.cue --
     6list: [1, 2, 3]
     7index: [1, 2, 3][1]
     8unify: [1, 2, 3] & [_, 2, 3]
     9e:     [] & 4
    10e2:    [3]["d"]
    11e3:    [3][-1]
    12e4:    [1, 2, ...>=4 & <=5] & [1, 2, 4, 8]
    13e5:    [1, 2, 4, 8] & [1, 2, ...>=4 & <=5]
    14-- out/def --
    15list: [1, 2, 3]
    16index: 2
    17unify: [1, 2, 3]
    18e:  _|_ // conflicting values [] and 4 (mismatched types list and int)
    19e2: _|_ // invalid list index "d" (type string)
    20e3: _|_ // invalid list index -1 (index must be non-negative)
    21e4: [1, 2, 4, _|_, // invalid value 8 (out of bound <=5)
    22]
    23e5: [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 --
    78Leaks:  4
    79Freed:  23
    80Reused: 20
    81Allocs: 7
    82Retain: 4
    83
    84Unifications: 27
    85Conjuncts:    46
    86Disjuncts:    26
    87-- out/evalalpha --
    88Errors:
    89e: conflicting values 4 and [] (mismatched types int and list):
    90    ./in.cue:4:8
    91    ./in.cue:4:13
    92e2: undefined field: d:
    93    ./in.cue:5:12
    94e3: invalid index -1 (index must be non-negative):
    95    ./in.cue:6:8
    96    ./in.cue:6:12
    97e4.3: invalid value 8 (out of bound <=5):
    98    ./in.cue:7:24
    99    ./in.cue:7:41
   100e5.3: invalid value 8 (out of bound <=5):
   101    ./in.cue:8:39
   102    ./in.cue:8:18
   103
   104Result:
   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 --
   156diff 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 --
   178error: more precise message
   179-- out/eval --
   180Errors:
   181e: conflicting values 4 and [] (mismatched types int and list):
   182    ./in.cue:4:8
   183    ./in.cue:4:13
   184e2: invalid list index d (type string):
   185    ./in.cue:5:12
   186e3: invalid index -1 (index must be non-negative):
   187    ./in.cue:6:8
   188    ./in.cue:6:12
   189e4.3: invalid value 8 (out of bound <=5):
   190    ./in.cue:7:24
   191    ./in.cue:7:41
   192e5.3: invalid value 8 (out of bound <=5):
   193    ./in.cue:8:39
   194    ./in.cue:8:18
   195
   196Result:
   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}

View as plain text