cuelang.org/go@v0.13.0/tools/trim/testdata/list_removal_2.txtar (about)

     1  This is correct. trimv2 resulted in
     2      service: a: {}
     3  but that creates an open list, rather than a closed list.
     4  The result here,
     5      service: a: ports: [_, _]
     6  is correct. You can observe the difference by adding
     7      x: service.a.ports & [_,_,_]
     8  which *should* cause an error.
     9  -- in.cue --
    10  service: [string]: {
    11  	ports: [{a: 1}, {a: 1}, ...{ extra: 3 }]
    12  }
    13  service: a: {
    14  	ports: [{a: 1}, {a: 1,}]
    15  }
    16  -- out/trim-v3 --
    17  == in.cue
    18  service: [string]: {
    19  	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
    20  }
    21  service: a: {
    22  	ports: [_, _]
    23  }
    24  -- diff/-out/trim-v3<==>+out/trim --
    25  diff old new
    26  --- old
    27  +++ new
    28  @@ -2,4 +2,6 @@
    29   service: [string]: {
    30   	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
    31   }
    32  -service: a: {}
    33  +service: a: {
    34  +	ports: [_, _]
    35  +}
    36  -- out/trim-v3-noshare --
    37  == in.cue
    38  service: [string]: {
    39  	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
    40  }
    41  service: a: {
    42  	ports: [_, _]
    43  }
    44  -- diff/-out/trim-v3-noshare<==>+out/trim --
    45  diff old new
    46  --- old
    47  +++ new
    48  @@ -2,4 +2,6 @@
    49   service: [string]: {
    50   	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
    51   }
    52  -service: a: {}
    53  +service: a: {
    54  +	ports: [_, _]
    55  +}
    56  -- out/trim --
    57  == in.cue
    58  service: [string]: {
    59  	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
    60  }
    61  service: a: {}