cuelang.org/go@v0.10.1/cue/testdata/basicrewrite/011_list_arithmetic.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: list arithmetic
     4  #evalPartial
     5  -- in.cue --
     6  list: [1, 2, 3]
     7  mul0: list * 0
     8  mul1: list * 1
     9  mul2: 2 * list
    10  list1: [1]
    11  mul1_0: list1 * 0
    12  mul1_1: 1 * list1
    13  mul1_2: list1 * 2
    14  add1_2: list + list1
    15  e:      list * -1
    16  -- out/def --
    17  list: [1, 2, 3]
    18  mul0: []
    19  mul1: [1, 2, 3]
    20  mul2: [1, 2, 3, 1, 2, 3]
    21  list1: [1]
    22  mul1_0: []
    23  mul1_1: [1]
    24  mul1_2: [1, 1]
    25  e: _|_ // negative number -1 multiplies list
    26  -- out/legacy-debug --
    27  <0>{list: [1,2,3], mul0: [], mul1: [1,2,3], mul2: [1,2,3,1,2,3], list1: [1], mul1_0: [], mul1_1: [1], mul1_2: [1,1], e: _|_((<1>.list * -1):negative number -1 multiplies list)}
    28  -- out/compile --
    29  --- in.cue
    30  {
    31    list: [
    32      1,
    33      2,
    34      3,
    35    ]
    36    mul0: (〈0;list〉 * 0)
    37    mul1: (〈0;list〉 * 1)
    38    mul2: (2 * 〈0;list〉)
    39    list1: [
    40      1,
    41    ]
    42    mul1_0: (〈0;list1〉 * 0)
    43    mul1_1: (1 * 〈0;list1〉)
    44    mul1_2: (〈0;list1〉 * 2)
    45    add1_2: (〈0;list〉 + 〈0;list1〉)
    46    e: (〈0;list〉 * -1)
    47  }
    48  -- out/eval/stats --
    49  Leaks:  7
    50  Freed:  31
    51  Reused: 28
    52  Allocs: 10
    53  Retain: 7
    54  
    55  Unifications: 38
    56  Conjuncts:    77
    57  Disjuncts:    38
    58  -- out/eval --
    59  Errors:
    60  e: cannot convert negative number to uint64:
    61      ./in.cue:10:9
    62  
    63  Result:
    64  (_|_){
    65    // [eval]
    66    list: (#list){
    67      0: (int){ 1 }
    68      1: (int){ 2 }
    69      2: (int){ 3 }
    70    }
    71    mul0: (#list){
    72    }
    73    mul1: (#list){
    74      0: (int){ 1 }
    75      1: (int){ 2 }
    76      2: (int){ 3 }
    77    }
    78    mul2: (#list){
    79      0: (int){ 1 }
    80      1: (int){ 2 }
    81      2: (int){ 3 }
    82      3: (int){ 1 }
    83      4: (int){ 2 }
    84      5: (int){ 3 }
    85    }
    86    list1: (#list){
    87      0: (int){ 1 }
    88    }
    89    mul1_0: (#list){
    90    }
    91    mul1_1: (#list){
    92      0: (int){ 1 }
    93    }
    94    mul1_2: (#list){
    95      0: (int){ 1 }
    96      1: (int){ 1 }
    97    }
    98    add1_2: (#list){
    99      0: (int){ 1 }
   100      1: (int){ 2 }
   101      2: (int){ 3 }
   102      3: (int){ 1 }
   103    }
   104    e: (_|_){
   105      // [eval] e: cannot convert negative number to uint64:
   106      //     ./in.cue:10:9
   107    }
   108  }