github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/builtins/list/issue332.txtar (about) 1 -- in.cue -- 2 import "list" 3 4 #d: { 5 #x: string 6 result: [#x] 7 } 8 #foo: { 9 X=#x: _ 10 y: list.FlattenN((#d & {#x: X}).result, 1) 11 } 12 r: #foo & { 13 #x: "hello" 14 } 15 -- out/eval -- 16 (struct){ 17 #d: (#struct){ 18 #x: (string){ string } 19 result: (#list){ 20 0: (string){ string } 21 } 22 } 23 #foo: (#struct){ 24 #x: (_){ _ } 25 y: (#list){ 26 0: (string){ string } 27 } 28 } 29 r: (#struct){ 30 #x: (string){ "hello" } 31 y: (#list){ 32 0: (string){ "hello" } 33 } 34 } 35 } 36 -- out/compile -- 37 --- in.cue 38 { 39 #d: { 40 #x: string 41 result: [ 42 〈1;#x〉, 43 ] 44 } 45 #foo: { 46 #x: _ 47 y: 〈import;list〉.FlattenN((〈1;#d〉 & { 48 #x: 〈1;#x〉 49 }).result, 1) 50 } 51 r: (〈0;#foo〉 & { 52 #x: "hello" 53 }) 54 }