...

Text file src/cuelang.org/go/cue/testdata/comprehensions/issue843.txtar

Documentation: cuelang.org/go/cue/testdata/comprehensions

     1-- in.cue --
     2package 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/stats --
    44Leaks:  9
    45Freed:  55
    46Reused: 41
    47Allocs: 23
    48Retain: 14
    49
    50Unifications: 52
    51Conjuncts:    120
    52Disjuncts:    66
    53-- out/eval --
    54(struct){
    55  #d1: (#struct){
    56    as: (list){
    57    }
    58    #c: (#list){
    59      0: (#struct){
    60        do: (string){ "f1" }
    61        as: (#list){
    62          0: (string){ "go" }
    63        }
    64      }
    65    }
    66  }
    67  #d2: (#struct){
    68    p: (string){ |(*(string){ "." }, (string){ string }) }
    69    #c: (#list){
    70      0: (#struct){
    71        do: (string){ "f2" }
    72        from: (#struct){
    73          #c: (#list){
    74            0: (#struct){
    75              do: (string){ "f1" }
    76              as: (#list){
    77                0: (string){ "go" }
    78                1: (string){ |(*(string){ "." }, (string){ string }) }
    79              }
    80            }
    81          }
    82          as: (#list){
    83            0: (string){ |(*(string){ "." }, (string){ string }) }
    84          }
    85        }
    86      }
    87    }
    88  }
    89  #c1: (_){
    90    _
    91    #c: (list){
    92    }
    93  }
    94  #o: (#struct){ |((#struct){
    95      do: (string){ "f1" }
    96      as: (list){
    97      }
    98    }, (#struct){
    99      do: (string){ "f2" }
   100      from: (_){
   101        _
   102        #c: (list){
   103        }
   104      }
   105    }) }
   106  #f1: (#struct){
   107    do: (string){ "f1" }
   108    as: (list){
   109    }
   110  }
   111  #f2: (#struct){
   112    do: (string){ "f2" }
   113    from: (_){
   114      _
   115      #c: (list){
   116      }
   117    }
   118  }
   119}
   120-- out/compile --
   121--- in.cue
   122{
   123  #d1: {
   124    as: [
   125      ...string,
   126    ]
   127    #c: [
   128      (〈2;#f1〉 & {
   129        as: ([
   130          "go",
   131        ] + 〈2;as〉)
   132      }),
   133    ]
   134  }
   135  #d2: {
   136    p: (*"."|string)
   137    #c: [
   138      (〈2;#f2〉 & {
   139        from: (〈3;#d1〉 & {
   140          as: [
   141            〈4;p〉,
   142          ]
   143        })
   144      }),
   145    ]
   146  }
   147  #c1: {
   148    #c: [
   149      ...〈2;#o〉,
   150    ]
   151    _
   152    ...
   153  }
   154  #o: (〈0;#f1〉|〈0;#f2〉)
   155  #f1: {
   156    do: "f1"
   157    as: [
   158      ...string,
   159    ]
   160  }
   161  #f2: {
   162    do: "f2"
   163    from: 〈1;#c1〉
   164  }
   165}

View as plain text