cuelang.org/go@v0.10.1/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/stats --
    44  Leaks:  9
    45  Freed:  55
    46  Reused: 41
    47  Allocs: 23
    48  Retain: 14
    49  
    50  Unifications: 52
    51  Conjuncts:    120
    52  Disjuncts:    66
    53  -- out/evalalpha --
    54  (struct){
    55    #d1: (#struct){
    56      as: (list){
    57      }
    58      #c: (#list){
    59        0: (#struct){
    60          as: (#list){
    61            0: (string){ "go" }
    62          }
    63          do: (string){ "f1" }
    64        }
    65      }
    66    }
    67    #d2: (#struct){
    68      p: (string){ |(*(string){ "." }, (string){ string }) }
    69      #c: (#list){
    70        0: (#struct){
    71          from: (#struct){
    72            as: (#list){
    73              0: (string){ |(*(string){ "." }, (string){ string }) }
    74            }
    75            #c: (#list){
    76              0: (#struct){
    77                as: (#list){
    78                  0: (string){ "go" }
    79                  1: (string){ |(*(string){ "." }, (string){ string }) }
    80                }
    81                do: (string){ "f1" }
    82              }
    83            }
    84          }
    85          do: (string){ "f2" }
    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  -- diff/-out/evalalpha<==>+out/eval --
   121  diff old new
   122  --- old
   123  +++ new
   124  @@ -4,10 +4,10 @@
   125       }
   126       #c: (#list){
   127         0: (#struct){
   128  -        do: (string){ "f1" }
   129           as: (#list){
   130             0: (string){ "go" }
   131           }
   132  +        do: (string){ "f1" }
   133         }
   134       }
   135     }
   136  @@ -15,21 +15,21 @@
   137       p: (string){ |(*(string){ "." }, (string){ string }) }
   138       #c: (#list){
   139         0: (#struct){
   140  -        do: (string){ "f2" }
   141           from: (#struct){
   142  +          as: (#list){
   143  +            0: (string){ |(*(string){ "." }, (string){ string }) }
   144  +          }
   145             #c: (#list){
   146               0: (#struct){
   147  -              do: (string){ "f1" }
   148                 as: (#list){
   149                   0: (string){ "go" }
   150                   1: (string){ |(*(string){ "." }, (string){ string }) }
   151                 }
   152  +              do: (string){ "f1" }
   153               }
   154             }
   155  -          as: (#list){
   156  -            0: (string){ |(*(string){ "." }, (string){ string }) }
   157  -          }
   158  -        }
   159  +        }
   160  +        do: (string){ "f2" }
   161         }
   162       }
   163     }
   164  -- diff/todo/p3 --
   165  Reordering
   166  -- out/eval --
   167  (struct){
   168    #d1: (#struct){
   169      as: (list){
   170      }
   171      #c: (#list){
   172        0: (#struct){
   173          do: (string){ "f1" }
   174          as: (#list){
   175            0: (string){ "go" }
   176          }
   177        }
   178      }
   179    }
   180    #d2: (#struct){
   181      p: (string){ |(*(string){ "." }, (string){ string }) }
   182      #c: (#list){
   183        0: (#struct){
   184          do: (string){ "f2" }
   185          from: (#struct){
   186            #c: (#list){
   187              0: (#struct){
   188                do: (string){ "f1" }
   189                as: (#list){
   190                  0: (string){ "go" }
   191                  1: (string){ |(*(string){ "." }, (string){ string }) }
   192                }
   193              }
   194            }
   195            as: (#list){
   196              0: (string){ |(*(string){ "." }, (string){ string }) }
   197            }
   198          }
   199        }
   200      }
   201    }
   202    #c1: (_){
   203      _
   204      #c: (list){
   205      }
   206    }
   207    #o: (#struct){ |((#struct){
   208        do: (string){ "f1" }
   209        as: (list){
   210        }
   211      }, (#struct){
   212        do: (string){ "f2" }
   213        from: (_){
   214          _
   215          #c: (list){
   216          }
   217        }
   218      }) }
   219    #f1: (#struct){
   220      do: (string){ "f1" }
   221      as: (list){
   222      }
   223    }
   224    #f2: (#struct){
   225      do: (string){ "f2" }
   226      from: (_){
   227        _
   228        #c: (list){
   229        }
   230      }
   231    }
   232  }
   233  -- out/compile --
   234  --- in.cue
   235  {
   236    #d1: {
   237      as: [
   238        ...string,
   239      ]
   240      #c: [
   241        (〈2;#f1〉 & {
   242          as: ([
   243            "go",
   244          ] + 〈2;as〉)
   245        }),
   246      ]
   247    }
   248    #d2: {
   249      p: (*"."|string)
   250      #c: [
   251        (〈2;#f2〉 & {
   252          from: (〈3;#d1〉 & {
   253            as: [
   254              〈4;p〉,
   255            ]
   256          })
   257        }),
   258      ]
   259    }
   260    #c1: {
   261      #c: [
   262        ...〈2;#o〉,
   263      ]
   264      _
   265      ...
   266    }
   267    #o: (〈0;#f1〉|〈0;#f2〉)
   268    #f1: {
   269      do: "f1"
   270      as: [
   271        ...string,
   272      ]
   273    }
   274    #f2: {
   275      do: "f2"
   276      from: 〈1;#c1〉
   277    }
   278  }