github.com/solo-io/cue@v0.4.7/cue/testdata/builtins/list/issue332.txtar (about)

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