github.com/solo-io/cue@v0.4.7/cue/testdata/comprehensions/issue507.txtar (about) 1 -- in.cue -- 2 package x 3 4 somelist: [...string] | * [] 5 // Works just fine 6 foo: [ 7 for e in somelist { 8 "hello foo: \(e)" 9 } 10 ] 11 12 otherlist: ["something"] 13 // Works fine as well 14 z: [ 15 for e in otherlist { 16 "hello z: \(e)" 17 } 18 ] 19 20 extlist: [...string] | * ["something"] 21 bar: [ 22 for e in extlist { 23 "hello bar: \(e)" 24 } 25 ] 26 -- out/eval -- 27 (struct){ 28 somelist: (list){ |(*(#list){ 29 }, (list){ 30 }) } 31 foo: (#list){ 32 } 33 otherlist: (#list){ 34 0: (string){ "something" } 35 } 36 z: (#list){ 37 0: (string){ "hello z: something" } 38 } 39 extlist: (list){ |(*(#list){ 40 0: (string){ "something" } 41 }, (list){ 42 }) } 43 bar: (#list){ 44 0: (string){ "hello bar: something" } 45 } 46 } 47 -- out/compile -- 48 --- in.cue 49 { 50 somelist: ([ 51 ...string, 52 ]|*[]) 53 foo: [ 54 for _, e in 〈0;somelist〉 { 55 "hello foo: \(〈1;e〉)" 56 }, 57 ] 58 otherlist: [ 59 "something", 60 ] 61 z: [ 62 for _, e in 〈0;otherlist〉 { 63 "hello z: \(〈1;e〉)" 64 }, 65 ] 66 extlist: ([ 67 ...string, 68 ]|*[ 69 "something", 70 ]) 71 bar: [ 72 for _, e in 〈0;extlist〉 { 73 "hello bar: \(〈1;e〉)" 74 }, 75 ] 76 }