github.com/solo-io/cue@v0.4.7/cue/testdata/comprehensions/issue843.txtar (about)

     1  -- in.cue --
     2  package main
     3  
     4  #d1: {
     5  	as: [...string]
     6  
     7  	#c: [
     8  		#f1 & {
     9  			"as": ["go"] + as
    10  		},
    11  	]
    12  }
    13  
    14  #d2: {
    15  	p: *"." | string
    16  
    17  	#c: [
    18  		#f2 & {
    19  			from: #d1 & {
    20  				as: [p]
    21  			}
    22  		},
    23  	]
    24  }
    25  
    26  #c1: {
    27  	#c: [...#o]
    28  	_
    29  	...
    30  }
    31  
    32  #o: #f1 | #f2
    33  
    34  #f1: {
    35  	do: "f1"
    36  	as: [...string]
    37  }
    38  
    39  #f2: {
    40  	do:   "f2"
    41  	from: #c1
    42  }
    43  -- out/eval --
    44  (struct){
    45    #d1: (#struct){
    46      as: (list){
    47      }
    48      #c: (#list){
    49        0: (#struct){
    50          do: (string){ "f1" }
    51          as: (#list){
    52            0: (string){ "go" }
    53          }
    54        }
    55      }
    56    }
    57    #d2: (#struct){
    58      p: (string){ |(*(string){ "." }, (string){ string }) }
    59      #c: (#list){
    60        0: (#struct){
    61          do: (string){ "f2" }
    62          from: (#struct){
    63            #c: (#list){
    64              0: (#struct){
    65                do: (string){ "f1" }
    66                as: (#list){
    67                  0: (string){ "go" }
    68                  1: (string){ |(*(string){ "." }, (string){ string }) }
    69                }
    70              }
    71            }
    72            as: (#list){
    73              0: (string){ |(*(string){ "." }, (string){ string }) }
    74            }
    75          }
    76        }
    77      }
    78    }
    79    #c1: (_){
    80      _
    81      #c: (list){
    82      }
    83    }
    84    #o: (#struct){ |((#struct){
    85        do: (string){ "f1" }
    86        as: (list){
    87        }
    88      }, (#struct){
    89        do: (string){ "f2" }
    90        from: (_){
    91          _
    92          #c: (list){
    93          }
    94        }
    95      }) }
    96    #f1: (#struct){
    97      do: (string){ "f1" }
    98      as: (list){
    99      }
   100    }
   101    #f2: (#struct){
   102      do: (string){ "f2" }
   103      from: (_){
   104        _
   105        #c: (list){
   106        }
   107      }
   108    }
   109  }
   110  -- out/compile --
   111  --- in.cue
   112  {
   113    #d1: {
   114      as: [
   115        ...string,
   116      ]
   117      #c: [
   118        (〈1;#f1〉 & {
   119          as: ([
   120            "go",
   121          ] + 〈1;as〉)
   122        }),
   123      ]
   124    }
   125    #d2: {
   126      p: (*"."|string)
   127      #c: [
   128        (〈1;#f2〉 & {
   129          from: (〈2;#d1〉 & {
   130            as: [
   131              〈2;p〉,
   132            ]
   133          })
   134        }),
   135      ]
   136    }
   137    #c1: {
   138      #c: [
   139        ...〈1;#o〉,
   140      ]
   141      _
   142      ...
   143    }
   144    #o: (〈0;#f1〉|〈0;#f2〉)
   145    #f1: {
   146      do: "f1"
   147      as: [
   148        ...string,
   149      ]
   150    }
   151    #f2: {
   152      do: "f2"
   153      from: 〈1;#c1〉
   154    }
   155  }