cuelang.org/go@v0.13.0/cue/testdata/comprehensions/issue843.txtar (about)

     1  -- in.cue --
     2  package main
     3  
     4  import "list"
     5  
     6  #d1: {
     7  	as: [...string]
     8  
     9  	#c: [
    10  		#f1 & {
    11  			"as": list.Concat([["go"], as])
    12  		},
    13  	]
    14  }
    15  
    16  #d2: {
    17  	p: *"." | string
    18  
    19  	#c: [
    20  		#f2 & {
    21  			from: #d1 & {
    22  				as: [p]
    23  			}
    24  		},
    25  	]
    26  }
    27  
    28  #c1: {
    29  	#c: [...#o]
    30  	_
    31  	...
    32  }
    33  
    34  #o: #f1 | #f2
    35  
    36  #f1: {
    37  	do: "f1"
    38  	as: [...string]
    39  }
    40  
    41  #f2: {
    42  	do:   "f2"
    43  	from: #c1
    44  }
    45  -- out/eval/stats --
    46  Leaks:  0
    47  Freed:  73
    48  Reused: 58
    49  Allocs: 15
    50  Retain: 7
    51  
    52  Unifications: 57
    53  Conjuncts:    138
    54  Disjuncts:    80
    55  -- out/evalalpha --
    56  (struct){
    57    #d1: (#struct){
    58      as: (list){
    59      }
    60      #c: (#list){
    61        0: (#struct){
    62          as: (#list){
    63            0: (string){ "go" }
    64          }
    65          do: (string){ "f1" }
    66        }
    67      }
    68    }
    69    #d2: (#struct){
    70      p: (string){ |(*(string){ "." }, (string){ string }) }
    71      #c: (#list){
    72        0: (#struct){
    73          from: (#struct){
    74            as: (#list){
    75              0: (string){ |(*(string){ "." }, (string){ string }) }
    76            }
    77            #c: (#list){
    78              0: (#struct){
    79                as: (#list){
    80                  0: (string){ "go" }
    81                  1: (string){ |(*(string){ "." }, (string){ string }) }
    82                }
    83                do: (string){ "f1" }
    84              }
    85            }
    86          }
    87          do: (string){ "f2" }
    88        }
    89      }
    90    }
    91    #c1: (_){
    92      _
    93      #c: (list){
    94      }
    95    }
    96    #o: (#struct){ |((#struct){
    97        do: (string){ "f1" }
    98        as: (list){
    99        }
   100      }, (#struct){
   101        do: (string){ "f2" }
   102        from: ~(#c1)
   103      }) }
   104    #f1: (#struct){
   105      do: (string){ "f1" }
   106      as: (list){
   107      }
   108    }
   109    #f2: (#struct){
   110      do: (string){ "f2" }
   111      from: ~(#c1)
   112    }
   113  }
   114  -- diff/-out/evalalpha<==>+out/eval --
   115  diff old new
   116  --- old
   117  +++ new
   118  @@ -4,10 +4,10 @@
   119       }
   120       #c: (#list){
   121         0: (#struct){
   122  -        do: (string){ "f1" }
   123           as: (#list){
   124             0: (string){ "go" }
   125           }
   126  +        do: (string){ "f1" }
   127         }
   128       }
   129     }
   130  @@ -15,21 +15,21 @@
   131       p: (string){ |(*(string){ "." }, (string){ string }) }
   132       #c: (#list){
   133         0: (#struct){
   134  -        do: (string){ "f2" }
   135           from: (#struct){
   136  +          as: (#list){
   137  +            0: (string){ |(*(string){ "." }, (string){ string }) }
   138  +          }
   139             #c: (#list){
   140               0: (#struct){
   141  -              do: (string){ "f1" }
   142                 as: (#list){
   143                   0: (string){ "go" }
   144                   1: (string){ |(*(string){ "." }, (string){ string }) }
   145                 }
   146  +              do: (string){ "f1" }
   147               }
   148             }
   149  -          as: (#list){
   150  -            0: (string){ |(*(string){ "." }, (string){ string }) }
   151  -          }
   152  -        }
   153  +        }
   154  +        do: (string){ "f2" }
   155         }
   156       }
   157     }
   158  @@ -44,11 +44,7 @@
   159         }
   160       }, (#struct){
   161         do: (string){ "f2" }
   162  -      from: (_){
   163  -        _
   164  -        #c: (list){
   165  -        }
   166  -      }
   167  +      from: ~(#c1)
   168       }) }
   169     #f1: (#struct){
   170       do: (string){ "f1" }
   171  @@ -57,10 +53,6 @@
   172     }
   173     #f2: (#struct){
   174       do: (string){ "f2" }
   175  -    from: (_){
   176  -      _
   177  -      #c: (list){
   178  -      }
   179  -    }
   180  +    from: ~(#c1)
   181     }
   182   }
   183  -- diff/todo/p3 --
   184  Reordering
   185  -- out/eval --
   186  (struct){
   187    #d1: (#struct){
   188      as: (list){
   189      }
   190      #c: (#list){
   191        0: (#struct){
   192          do: (string){ "f1" }
   193          as: (#list){
   194            0: (string){ "go" }
   195          }
   196        }
   197      }
   198    }
   199    #d2: (#struct){
   200      p: (string){ |(*(string){ "." }, (string){ string }) }
   201      #c: (#list){
   202        0: (#struct){
   203          do: (string){ "f2" }
   204          from: (#struct){
   205            #c: (#list){
   206              0: (#struct){
   207                do: (string){ "f1" }
   208                as: (#list){
   209                  0: (string){ "go" }
   210                  1: (string){ |(*(string){ "." }, (string){ string }) }
   211                }
   212              }
   213            }
   214            as: (#list){
   215              0: (string){ |(*(string){ "." }, (string){ string }) }
   216            }
   217          }
   218        }
   219      }
   220    }
   221    #c1: (_){
   222      _
   223      #c: (list){
   224      }
   225    }
   226    #o: (#struct){ |((#struct){
   227        do: (string){ "f1" }
   228        as: (list){
   229        }
   230      }, (#struct){
   231        do: (string){ "f2" }
   232        from: (_){
   233          _
   234          #c: (list){
   235          }
   236        }
   237      }) }
   238    #f1: (#struct){
   239      do: (string){ "f1" }
   240      as: (list){
   241      }
   242    }
   243    #f2: (#struct){
   244      do: (string){ "f2" }
   245      from: (_){
   246        _
   247        #c: (list){
   248        }
   249      }
   250    }
   251  }
   252  -- out/compile --
   253  --- in.cue
   254  {
   255    #d1: {
   256      as: [
   257        ...string,
   258      ]
   259      #c: [
   260        (〈2;#f1〉 & {
   261          as: 〈import;list〉.Concat([
   262            [
   263              "go",
   264            ],
   265            〈3;as〉,
   266          ])
   267        }),
   268      ]
   269    }
   270    #d2: {
   271      p: (*"."|string)
   272      #c: [
   273        (〈2;#f2〉 & {
   274          from: (〈3;#d1〉 & {
   275            as: [
   276              〈4;p〉,
   277            ]
   278          })
   279        }),
   280      ]
   281    }
   282    #c1: {
   283      #c: [
   284        ...〈2;#o〉,
   285      ]
   286      _
   287      ...
   288    }
   289    #o: (〈0;#f1〉|〈0;#f2〉)
   290    #f1: {
   291      do: "f1"
   292      as: [
   293        ...string,
   294      ]
   295    }
   296    #f2: {
   297      do: "f2"
   298      from: 〈1;#c1〉
   299    }
   300  }