-- in.cue -- import "list" repeat: { [string]: {x: _, n: int, v: list.Repeat(x, n)} t1: {x: [], n: 0} t2: {x: [1], n: 0} t3: {x: [1], n: 1} t4: {x: [1, 2], n: 1} t5: {x: [], n: 3} t6: {x: [1, 2], n: 3} t7: {x: [1, 2, 3, 4], n: 3} t8: {x: [1], n: -1} } concat: { [string]: {x: _, v: list.Concat(x)} t1: x: [] t2: x: [[]] t3: x: [[1]] t4: x: [[1, 2]] t5: x: [[1], [2]] t6: x: [[1, 2], [3, 4]] t7: x: 1 t8: x: [1, [2]] } unique: { issue797: { mylst: [ {foo: "bar"}, {foo: "baz"}, ] _testmylst: list.UniqueItems & [ for x in mylst {x.foo}] } } // Issue #2099 minItems: { [string]: list.MinItems(1) incomplete1: [...] fail1: [] ok1: [0, ...] ok2: [0] } maxItems: { [string]: list.MaxItems(1) ok1: [...] ok2: [0, ...] ok3: [0, ...] fail1: [0, 1] } -- out/list -- Errors: repeat.t8.v: error in call to list.Repeat: negative count: ./in.cue:4:30 concat.t8.v: error in call to list.Concat: cannot use value 1 (type int) as list: ./in.cue:19:22 ./in.cue:31:10 concat.t7.v: cannot use 1 (type int) as list in argument 1 to list.Concat: ./in.cue:30:9 minItems.fail1: invalid value [] (does not satisfy list.MinItems(1)): len(list) < MinItems(1) (0 < 1): ./in.cue:45:12 ./in.cue:45:26 ./in.cue:47:9 maxItems.fail1: invalid value [0,1] (does not satisfy list.MaxItems(1)): len(list) > MaxItems(1) (2 > 1): ./in.cue:53:12 ./in.cue:53:26 ./in.cue:58:9 Result: import "list" repeat: { t1: { x: [] n: 0 v: [] } t2: { x: [1] n: 0 v: [] } t3: { x: [1] n: 1 v: [1] } t4: { x: [1, 2] n: 1 v: [1, 2] } t5: { x: [] n: 3 v: [] } t6: { x: [1, 2] n: 3 v: [1, 2, 1, 2, 1, 2] } t7: { x: [1, 2, 3, 4] n: 3 v: [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4] } t8: { x: [1] n: -1 v: _|_ // repeat.t8.v: error in call to list.Repeat: negative count } } concat: { t1: { x: [] v: [] } t2: { x: [[]] v: [] } t3: { x: [[1]] v: [1] } t4: { x: [[1, 2]] v: [1, 2] } t5: { x: [[1], [2]] v: [1, 2] } t6: { x: [[1, 2], [3, 4]] v: [1, 2, 3, 4] } t7: { x: 1 v: _|_ // concat.t7.v: cannot use 1 (type int) as list in argument 1 to list.Concat } t8: { x: [1, [2]] v: _|_ // concat.t8.v: error in call to list.Concat: cannot use value 1 (type int) as list } } unique: { issue797: { mylst: [{ foo: "bar" }, { foo: "baz" }] } } // Issue #2099 minItems: { incomplete1: [...] & list.MinItems(1) fail1: _|_ // minItems.fail1: invalid value [] (does not satisfy list.MinItems(1)): len(list) < MinItems(1) (0 < 1) (and 1 more errors) ok1: [0, ...] ok2: [0] } maxItems: { ok1: [...] ok2: [0, ...] ok3: [0, ...] fail1: _|_ // maxItems.fail1: invalid value [0,1] (does not satisfy list.MaxItems(1)): len(list) > MaxItems(1) (2 > 1) (and 1 more errors) }