cuelang.org/go@v0.10.1/cue/testdata/builtins/issue299.txtar (about)

     1  -- in.cue --
     2  import "list"
     3  
     4  x: list.UniqueItems
     5  x: [string, ...string]
     6  x: ["x", "x"]
     7  -- out/eval/stats --
     8  Leaks:  0
     9  Freed:  2
    10  Reused: 0
    11  Allocs: 2
    12  Retain: 0
    13  
    14  Unifications: 2
    15  Conjuncts:    5
    16  Disjuncts:    3
    17  -- out/eval --
    18  Errors:
    19  x: invalid value ["x","x"] (does not satisfy list.UniqueItems):
    20      ./in.cue:3:4
    21      ./in.cue:4:4
    22      ./in.cue:5:4
    23  
    24  Result:
    25  (_|_){
    26    // [eval]
    27    x: (_|_){
    28      // [eval] x: invalid value ["x","x"] (does not satisfy list.UniqueItems):
    29      //     ./in.cue:3:4
    30      //     ./in.cue:4:4
    31      //     ./in.cue:5:4
    32      0: (string){ "x" }
    33      1: (string){ "x" }
    34    }
    35  }
    36  -- out/compile --
    37  --- in.cue
    38  {
    39    x: 〈import;list〉.UniqueItems
    40    x: [
    41      string,
    42      ...string,
    43    ]
    44    x: [
    45      "x",
    46      "x",
    47    ]
    48  }