cuelang.org/go@v0.13.0/cue/testdata/cycle/chain.txtar (about)

     1  -- in.cue --
     2  import "list"
     3  
     4  // The following just chains existing fields and should NOT trigger a cycle
     5  // detection error.
     6  
     7  
     8  chain: t1: {
     9  	#maxiter: 2
    10  
    11  	// Trigger lookup of a.x0 before the "regular" evaluation of a.
    12  	x: a.x0
    13  
    14  	a: {
    15  		for k, _ in [0, 1] {
    16  			"x\(k)": (#DepthF & {#in: a["x\(k+1)"]}).#out
    17  		}
    18  	}
    19  
    20  	a: x2: null
    21  
    22  
    23  	#DepthF: {
    24  		#in: _
    25  		#out: {}
    26  	}
    27  }
    28  
    29  chain: t2: p1: {
    30  	X: 1
    31  
    32  	// Reference X through x.x0 before X is inserted.
    33  	for v in list.Concat([[0, X], []]) {
    34  		x: "x\(v)": {}
    35  	}
    36  
    37  	x: _
    38  
    39  	x.x0
    40  }
    41  
    42  chain: t2: p2: {
    43  	// Reference X through x.x0 before X is inserted.
    44  	for v in list.Concat([[0, X], []]) {
    45  		x: "x\(v)": {}
    46  	}
    47  
    48  	x: _
    49  
    50  	x.x0
    51  
    52  	X: 1
    53  }
    54  
    55  chain: t3: p1: {
    56  	X: 1
    57  
    58  	for v in list.Range(0, X, 1) {
    59  		x: "x\(v)": {}
    60  	}
    61  
    62  	x: _
    63  
    64  	x.x0
    65  }
    66  
    67  chain: t3: p1: {
    68  	for v in list.Range(0, X, 1) {
    69  		x: "x\(v)": {}
    70  	}
    71  
    72  	x: _
    73  
    74  	x.x0
    75  
    76  	X: 1
    77  }
    78  
    79  -- issue2052.cue --
    80  import (
    81  	"list"
    82  	"math"
    83  )
    84  issue2052: reduced: t1: {
    85  	A: a: _
    86  	Depth: {
    87  		#maxiter: 1
    88  		if math.Abs(#maxiter) == 1 {
    89  			funcs: "\(0)": A
    90  		}
    91  		funcs: {}
    92  		funcs["0"]
    93  	}
    94  }
    95  issue2052: reduced: t2: {
    96  	A: a: _
    97  	Depth: {
    98  		maxiter: 1
    99  		for k, v in list.Range(0, maxiter, 1) {
   100  			funcs: "\(0)": A
   101  		}
   102  		funcs: {}
   103  		funcs["0"]
   104  	}
   105  }
   106  issue2052: medium: t1: {
   107  	#Depth: {
   108  		#maxiter: 4
   109  
   110  		for k, v in list.Range(0, #maxiter, 1) {
   111  			#funcs: "\(k)": (#DepthF & {#next: #funcs["\(k+1)"]}).#func
   112  		}
   113  
   114  		#funcs: "\(#maxiter)": null
   115  
   116  		#funcs["0"]
   117  	}
   118  
   119  	#DepthF: {
   120  		#next: _
   121  		#func: {
   122  			#in:    _
   123  			#basic: string | null
   124  			out: {
   125  				if (#in & #basic) != _|_ {1}
   126  				if (#in & #basic) == _|_ {
   127  					list.Max([for k, v in #in {(#next & {#in: v}).out}]) + 1
   128  				}
   129  			}
   130  		}
   131  	}
   132  
   133  	tree: "bar"
   134  
   135  	d: #Depth & {#in: tree}
   136  
   137  }
   138  
   139  issue2052: medium: t2: {
   140  	#Depth: {
   141  		#maxiter: 4
   142  
   143  		for k, v in list.Range(0, #maxiter, 1) {
   144  			#funcs: "\(k)": (#DepthF & {#next: #funcs["\(k+1)"]}).#func
   145  		}
   146  
   147  		#funcs:{
   148  			for k, v in list.Range(0, #maxiter, 1) {
   149  				 "\(k)": (#DepthF & {#next: #funcs["\(k+1)"]}).#func
   150  			}
   151  		}
   152  
   153  		#funcs: "\(#maxiter)": null
   154  
   155  		#funcs["0"]
   156  	}
   157  
   158  	#DepthF: {
   159  		#next: _
   160  		#func: {
   161  			#in:    _
   162  			#basic: string | null
   163  			out: {
   164  				if (#in & #basic) != _|_ {1}
   165  				if (#in & #basic) == _|_ {
   166  					list.Max([for k, v in #in {(#next & {#in: v}).out}]) + 1
   167  				}
   168  			}
   169  		}
   170  	}
   171  
   172  	tree: "bar"
   173  
   174  	d: #Depth & {#in: tree}
   175  }
   176  
   177  issue2052: full: {
   178  	#RecurseN: {
   179  		// this is the bound on our recursion
   180  		#maxiter: uint | *4
   181  
   182  		// This is the function list element
   183  		// we generate this to simulate recursion
   184  		#funcFactory: {
   185  			#next: _
   186  			#func: _
   187  		}
   188  
   189  		// this is our "recursion unrolling"
   190  		for k, v in list.Range(0, #maxiter, 1) {
   191  			// this is where we build up our indexed functions and the references between them
   192  			#funcs: "\(k)": (#funcFactory & {#next: #funcs["\(k+1)"]}).#func
   193  		}
   194  
   195  		// our final value needs to be null
   196  		#funcs: "\(#maxiter)": null
   197  
   198  		// we embed the head of the list so that the values
   199  		// we write this into can be used like other CUE "functions"
   200  		#funcs["0"]
   201  	}
   202  
   203  	#DepthF: {
   204  		#next: _
   205  		#func: {
   206  			#in:    _
   207  			#basic: int | number | string | bytes | null
   208  			out: {
   209  				// if we have a basic type, we are at a leaf, depth is 1
   210  				if (#in & #basic) != _|_ {1}
   211  
   212  				// if we are not a basic type, then we are 1 + the max of children
   213  				if (#in & #basic) == _|_ {
   214  					// this is our "recursion" for each child
   215  					let depths = [for k, v in #in {(#next & {#in: v}).out}]
   216  					list.Max(depths) + 1
   217  				}
   218  			}
   219  		}
   220  	}
   221  
   222  	#Depth: #RecurseN & {#maxiter: 11, #funcFactory: #DepthF}
   223  
   224  	tree: {
   225  		a: {
   226  			foo: "bar"
   227  			a: b: c: "d"
   228  		}
   229  		cow: "moo"
   230  	}
   231  
   232  	d: #Depth & {#in: tree}
   233  }
   234  -- out/evalalpha --
   235  (struct){
   236    chain: (struct){
   237      t1: (struct){
   238        #maxiter: (int){ 2 }
   239        x: (#struct){
   240        }
   241        a: (struct){
   242          x2: (null){ null }
   243          x0: (#struct){
   244          }
   245          x1: (#struct){
   246          }
   247        }
   248        #DepthF: (#struct){
   249          #in: (_){ _ }
   250          #out: (#struct){
   251          }
   252        }
   253      }
   254      t2: (struct){
   255        p1: (struct){
   256          X: (int){ 1 }
   257          x: (struct){
   258            x0: (struct){
   259            }
   260            x1: (struct){
   261            }
   262          }
   263        }
   264        p2: (struct){
   265          x: (struct){
   266            x0: (struct){
   267            }
   268            x1: (struct){
   269            }
   270          }
   271          X: (int){ 1 }
   272        }
   273      }
   274      t3: (struct){
   275        p1: (struct){
   276          X: (int){ 1 }
   277          x: (struct){
   278            x0: (struct){
   279            }
   280          }
   281        }
   282      }
   283    }
   284    issue2052: (struct){
   285      reduced: (struct){
   286        t1: (struct){
   287          A: (struct){
   288            a: (_){ _ }
   289          }
   290          Depth: (struct){
   291            #maxiter: (int){ 1 }
   292            funcs: (struct){
   293              "0": ~(issue2052.reduced.t1.A)
   294            }
   295            a: (_){ _ }
   296          }
   297        }
   298        t2: (struct){
   299          A: (struct){
   300            a: (_){ _ }
   301          }
   302          Depth: (struct){
   303            maxiter: (int){ 1 }
   304            funcs: (struct){
   305              "0": ~(issue2052.reduced.t2.A)
   306            }
   307            a: (_){ _ }
   308          }
   309        }
   310      }
   311      medium: (struct){
   312        t1: (struct){
   313          #Depth: (#struct){
   314            #maxiter: (int){ 4 }
   315            #funcs: (#struct){
   316              "4": (null){ null }
   317              "0": (#struct){
   318                #in: (_){ _ }
   319                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   320                out: (int){ 1 }
   321              }
   322              "1": (#struct){
   323                #in: (_){ _ }
   324                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   325                out: (int){ 1 }
   326              }
   327              "2": (#struct){
   328                #in: (_){ _ }
   329                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   330                out: (int){ 1 }
   331              }
   332              "3": (#struct){
   333                #in: (_){ _ }
   334                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   335                out: (int){ 1 }
   336              }
   337            }
   338            #in: (_){ _ }
   339            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   340            out: (int){ 1 }
   341          }
   342          #DepthF: (#struct){
   343            #next: (_){ _ }
   344            #func: (#struct){
   345              #in: (_){ _ }
   346              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   347              out: (int){ 1 }
   348            }
   349          }
   350          tree: (string){ "bar" }
   351          d: (#struct){
   352            #in: (string){ "bar" }
   353            #maxiter: (int){ 4 }
   354            #funcs: (#struct){
   355              "4": (null){ null }
   356              "0": (#struct){
   357                #in: (_){ _ }
   358                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   359                out: (int){ 1 }
   360              }
   361              "1": (#struct){
   362                #in: (_){ _ }
   363                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   364                out: (int){ 1 }
   365              }
   366              "2": (#struct){
   367                #in: (_){ _ }
   368                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   369                out: (int){ 1 }
   370              }
   371              "3": (#struct){
   372                #in: (_){ _ }
   373                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   374                out: (int){ 1 }
   375              }
   376            }
   377            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   378            out: (int){ 1 }
   379          }
   380        }
   381        t2: (struct){
   382          #Depth: (#struct){
   383            #maxiter: (int){ 4 }
   384            #funcs: (#struct){
   385              "4": (null){ null }
   386              "0": (#struct){
   387                #in: (_){ _ }
   388                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   389                out: (int){ 1 }
   390              }
   391              "1": (#struct){
   392                #in: (_){ _ }
   393                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   394                out: (int){ 1 }
   395              }
   396              "2": (#struct){
   397                #in: (_){ _ }
   398                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   399                out: (int){ 1 }
   400              }
   401              "3": (#struct){
   402                #in: (_){ _ }
   403                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   404                out: (int){ 1 }
   405              }
   406            }
   407            #in: (_){ _ }
   408            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   409            out: (int){ 1 }
   410          }
   411          #DepthF: (#struct){
   412            #next: (_){ _ }
   413            #func: (#struct){
   414              #in: (_){ _ }
   415              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   416              out: (int){ 1 }
   417            }
   418          }
   419          tree: (string){ "bar" }
   420          d: (#struct){
   421            #in: (string){ "bar" }
   422            #maxiter: (int){ 4 }
   423            #funcs: (#struct){
   424              "4": (null){ null }
   425              "0": (#struct){
   426                #in: (_){ _ }
   427                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   428                out: (int){ 1 }
   429              }
   430              "1": (#struct){
   431                #in: (_){ _ }
   432                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   433                out: (int){ 1 }
   434              }
   435              "2": (#struct){
   436                #in: (_){ _ }
   437                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   438                out: (int){ 1 }
   439              }
   440              "3": (#struct){
   441                #in: (_){ _ }
   442                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   443                out: (int){ 1 }
   444              }
   445            }
   446            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   447            out: (int){ 1 }
   448          }
   449        }
   450      }
   451      full: (struct){
   452        #RecurseN: (_){
   453          _
   454          #maxiter: (int){ |(*(int){ 4 }, (int){ &(>=0, int) }) }
   455          #funcFactory: (#struct){
   456            #next: (_){ _ }
   457            #func: (_){ _ }
   458          }
   459          #funcs: (#struct){
   460            "4": (null){ null }
   461            "0": (_){ _ }
   462            "1": (_){ _ }
   463            "2": (_){ _ }
   464            "3": (_){ _ }
   465          }
   466        }
   467        #DepthF: (#struct){
   468          #next: (_){ _ }
   469          #func: (#struct){
   470            #in: (_){ _ }
   471            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   472            out: (int){
   473              1
   474              let depths#1multi = [
   475                for k, v in 〈3;#in〉 {
   476                  (〈6;#next〉 & {
   477                    #in: 〈2;v〉
   478                  }).out
   479                },
   480              ]
   481            }
   482          }
   483        }
   484        #Depth: (#struct){
   485          #maxiter: (int){ 11 }
   486          #funcFactory: (#struct){
   487            #next: (_){ _ }
   488            #func: (#struct){
   489              #in: (_){ _ }
   490              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   491              out: (int){
   492                1
   493                let depths#1multi = [
   494                  for k, v in 〈3;#in〉 {
   495                    (〈6;#next〉 & {
   496                      #in: 〈2;v〉
   497                    }).out
   498                  },
   499                ]
   500              }
   501            }
   502          }
   503          #funcs: (#struct){
   504            "11": (null){ null }
   505            "0": (#struct){
   506              #in: (_){ _ }
   507              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   508              out: (int){
   509                1
   510                let depths#1multi = [
   511                  for k, v in 〈3;#in〉 {
   512                    (〈6;#next〉 & {
   513                      #in: 〈2;v〉
   514                    }).out
   515                  },
   516                ]
   517              }
   518            }
   519            "1": (#struct){
   520              #in: (_){ _ }
   521              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   522              out: (int){
   523                1
   524                let depths#1multi = [
   525                  for k, v in 〈3;#in〉 {
   526                    (〈6;#next〉 & {
   527                      #in: 〈2;v〉
   528                    }).out
   529                  },
   530                ]
   531              }
   532            }
   533            "2": (#struct){
   534              #in: (_){ _ }
   535              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   536              out: (int){
   537                1
   538                let depths#1multi = [
   539                  for k, v in 〈3;#in〉 {
   540                    (〈6;#next〉 & {
   541                      #in: 〈2;v〉
   542                    }).out
   543                  },
   544                ]
   545              }
   546            }
   547            "3": (#struct){
   548              #in: (_){ _ }
   549              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   550              out: (int){
   551                1
   552                let depths#1multi = [
   553                  for k, v in 〈3;#in〉 {
   554                    (〈6;#next〉 & {
   555                      #in: 〈2;v〉
   556                    }).out
   557                  },
   558                ]
   559              }
   560            }
   561            "4": (#struct){
   562              #in: (_){ _ }
   563              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   564              out: (int){
   565                1
   566                let depths#1multi = [
   567                  for k, v in 〈3;#in〉 {
   568                    (〈6;#next〉 & {
   569                      #in: 〈2;v〉
   570                    }).out
   571                  },
   572                ]
   573              }
   574            }
   575            "5": (#struct){
   576              #in: (_){ _ }
   577              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   578              out: (int){
   579                1
   580                let depths#1multi = [
   581                  for k, v in 〈3;#in〉 {
   582                    (〈6;#next〉 & {
   583                      #in: 〈2;v〉
   584                    }).out
   585                  },
   586                ]
   587              }
   588            }
   589            "6": (#struct){
   590              #in: (_){ _ }
   591              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   592              out: (int){
   593                1
   594                let depths#1multi = [
   595                  for k, v in 〈3;#in〉 {
   596                    (〈6;#next〉 & {
   597                      #in: 〈2;v〉
   598                    }).out
   599                  },
   600                ]
   601              }
   602            }
   603            "7": (#struct){
   604              #in: (_){ _ }
   605              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   606              out: (int){
   607                1
   608                let depths#1multi = [
   609                  for k, v in 〈3;#in〉 {
   610                    (〈6;#next〉 & {
   611                      #in: 〈2;v〉
   612                    }).out
   613                  },
   614                ]
   615              }
   616            }
   617            "8": (#struct){
   618              #in: (_){ _ }
   619              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   620              out: (int){
   621                1
   622                let depths#1multi = [
   623                  for k, v in 〈3;#in〉 {
   624                    (〈6;#next〉 & {
   625                      #in: 〈2;v〉
   626                    }).out
   627                  },
   628                ]
   629              }
   630            }
   631            "9": (#struct){
   632              #in: (_){ _ }
   633              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   634              out: (int){
   635                1
   636                let depths#1multi = [
   637                  for k, v in 〈3;#in〉 {
   638                    (〈6;#next〉 & {
   639                      #in: 〈2;v〉
   640                    }).out
   641                  },
   642                ]
   643              }
   644            }
   645            "10": (#struct){
   646              #in: (_){ _ }
   647              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   648              out: (int){
   649                1
   650                let depths#1multi = [
   651                  for k, v in 〈3;#in〉 {
   652                    (〈6;#next〉 & {
   653                      #in: 〈2;v〉
   654                    }).out
   655                  },
   656                ]
   657              }
   658            }
   659          }
   660          #in: (_){ _ }
   661          #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   662          out: (int){
   663            1
   664            let depths#1multi = [
   665              for k, v in 〈3;#in〉 {
   666                (〈6;#next〉 & {
   667                  #in: 〈2;v〉
   668                }).out
   669              },
   670            ]
   671          }
   672        }
   673        tree: (struct){
   674          a: (struct){
   675            foo: (string){ "bar" }
   676            a: (struct){
   677              b: (struct){
   678                c: (string){ "d" }
   679              }
   680            }
   681          }
   682          cow: (string){ "moo" }
   683        }
   684        d: (#struct){
   685          #in: (#struct){
   686            a: (#struct){
   687              foo: (string){ "bar" }
   688              a: (#struct){
   689                b: (#struct){
   690                  c: (string){ "d" }
   691                }
   692              }
   693            }
   694            cow: (string){ "moo" }
   695          }
   696          #maxiter: (int){ 11 }
   697          #funcFactory: (#struct){
   698            #next: (_){ _ }
   699            #func: (#struct){
   700              #in: (_){ _ }
   701              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   702              out: (int){
   703                1
   704                let depths#1multi = [
   705                  for k, v in 〈3;#in〉 {
   706                    (〈6;#next〉 & {
   707                      #in: 〈2;v〉
   708                    }).out
   709                  },
   710                ]
   711              }
   712            }
   713          }
   714          #funcs: (#struct){
   715            "11": (null){ null }
   716            "0": (#struct){
   717              #in: (_){ _ }
   718              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   719              out: (int){
   720                1
   721                let depths#1multi = [
   722                  for k, v in 〈3;#in〉 {
   723                    (〈6;#next〉 & {
   724                      #in: 〈2;v〉
   725                    }).out
   726                  },
   727                ]
   728              }
   729            }
   730            "1": (#struct){
   731              #in: (_){ _ }
   732              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   733              out: (int){
   734                1
   735                let depths#1multi = [
   736                  for k, v in 〈3;#in〉 {
   737                    (〈6;#next〉 & {
   738                      #in: 〈2;v〉
   739                    }).out
   740                  },
   741                ]
   742              }
   743            }
   744            "2": (#struct){
   745              #in: (_){ _ }
   746              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   747              out: (int){
   748                1
   749                let depths#1multi = [
   750                  for k, v in 〈3;#in〉 {
   751                    (〈6;#next〉 & {
   752                      #in: 〈2;v〉
   753                    }).out
   754                  },
   755                ]
   756              }
   757            }
   758            "3": (#struct){
   759              #in: (_){ _ }
   760              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   761              out: (int){
   762                1
   763                let depths#1multi = [
   764                  for k, v in 〈3;#in〉 {
   765                    (〈6;#next〉 & {
   766                      #in: 〈2;v〉
   767                    }).out
   768                  },
   769                ]
   770              }
   771            }
   772            "4": (#struct){
   773              #in: (_){ _ }
   774              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   775              out: (int){
   776                1
   777                let depths#1multi = [
   778                  for k, v in 〈3;#in〉 {
   779                    (〈6;#next〉 & {
   780                      #in: 〈2;v〉
   781                    }).out
   782                  },
   783                ]
   784              }
   785            }
   786            "5": (#struct){
   787              #in: (_){ _ }
   788              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   789              out: (int){
   790                1
   791                let depths#1multi = [
   792                  for k, v in 〈3;#in〉 {
   793                    (〈6;#next〉 & {
   794                      #in: 〈2;v〉
   795                    }).out
   796                  },
   797                ]
   798              }
   799            }
   800            "6": (#struct){
   801              #in: (_){ _ }
   802              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   803              out: (int){
   804                1
   805                let depths#1multi = [
   806                  for k, v in 〈3;#in〉 {
   807                    (〈6;#next〉 & {
   808                      #in: 〈2;v〉
   809                    }).out
   810                  },
   811                ]
   812              }
   813            }
   814            "7": (#struct){
   815              #in: (_){ _ }
   816              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   817              out: (int){
   818                1
   819                let depths#1multi = [
   820                  for k, v in 〈3;#in〉 {
   821                    (〈6;#next〉 & {
   822                      #in: 〈2;v〉
   823                    }).out
   824                  },
   825                ]
   826              }
   827            }
   828            "8": (#struct){
   829              #in: (_){ _ }
   830              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   831              out: (int){
   832                1
   833                let depths#1multi = [
   834                  for k, v in 〈3;#in〉 {
   835                    (〈6;#next〉 & {
   836                      #in: 〈2;v〉
   837                    }).out
   838                  },
   839                ]
   840              }
   841            }
   842            "9": (#struct){
   843              #in: (_){ _ }
   844              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   845              out: (int){
   846                1
   847                let depths#1multi = [
   848                  for k, v in 〈3;#in〉 {
   849                    (〈6;#next〉 & {
   850                      #in: 〈2;v〉
   851                    }).out
   852                  },
   853                ]
   854              }
   855            }
   856            "10": (#struct){
   857              #in: (_){ _ }
   858              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   859              out: (int){
   860                1
   861                let depths#1multi = [
   862                  for k, v in 〈3;#in〉 {
   863                    (〈6;#next〉 & {
   864                      #in: 〈2;v〉
   865                    }).out
   866                  },
   867                ]
   868              }
   869            }
   870          }
   871          #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
   872          out: (int){
   873            5
   874            let depths#1multi = [
   875              for k, v in 〈3;#in〉 {
   876                (〈6;#next〉 & {
   877                  #in: 〈2;v〉
   878                }).out
   879              },
   880            ]
   881          }
   882        }
   883      }
   884    }
   885  }
   886  -- diff/-out/evalalpha<==>+out/eval --
   887  diff old new
   888  --- old
   889  +++ new
   890  @@ -27,15 +27,11 @@
   891             }
   892           }
   893         }
   894  -      p2: (_|_){
   895  -        // [incomplete] chain.t2.p2.0.1: invalid interpolation: cycle error referencing X:
   896  -        //     ./in.cue:44:6
   897  -        //     ./in.cue:43:28
   898  -        x: (_|_){
   899  -          // [incomplete] chain.t2.p2.0.1: invalid interpolation: cycle error referencing X:
   900  -          //     ./in.cue:44:6
   901  -          //     ./in.cue:43:28
   902  -          x0: (struct){
   903  +      p2: (struct){
   904  +        x: (struct){
   905  +          x0: (struct){
   906  +          }
   907  +          x1: (struct){
   908             }
   909           }
   910           X: (int){ 1 }
   911  @@ -60,9 +56,7 @@
   912           Depth: (struct){
   913             #maxiter: (int){ 1 }
   914             funcs: (struct){
   915  -            "0": (struct){
   916  -              a: (_){ _ }
   917  -            }
   918  +            "0": ~(issue2052.reduced.t1.A)
   919             }
   920             a: (_){ _ }
   921           }
   922  @@ -74,9 +68,7 @@
   923           Depth: (struct){
   924             maxiter: (int){ 1 }
   925             funcs: (struct){
   926  -            "0": (struct){
   927  -              a: (_){ _ }
   928  -            }
   929  +            "0": ~(issue2052.reduced.t2.A)
   930             }
   931             a: (_){ _ }
   932           }
   933  @@ -123,100 +115,100 @@
   934           }
   935           tree: (string){ "bar" }
   936           d: (#struct){
   937  -          #maxiter: (int){ 4 }
   938  -          #funcs: (#struct){
   939  -            "4": (null){ null }
   940  -            "0": (#struct){
   941  -              #in: (_){ _ }
   942  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   943  -              out: (int){ 1 }
   944  -            }
   945  -            "1": (#struct){
   946  -              #in: (_){ _ }
   947  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   948  -              out: (int){ 1 }
   949  -            }
   950  -            "2": (#struct){
   951  -              #in: (_){ _ }
   952  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   953  -              out: (int){ 1 }
   954  -            }
   955  -            "3": (#struct){
   956  -              #in: (_){ _ }
   957  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   958  -              out: (int){ 1 }
   959  -            }
   960  -          }
   961  -          #in: (string){ "bar" }
   962  -          #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   963  -          out: (int){ 1 }
   964  -        }
   965  -      }
   966  -      t2: (struct){
   967  -        #Depth: (#struct){
   968  -          #maxiter: (int){ 4 }
   969  -          #funcs: (#struct){
   970  -            "4": (null){ null }
   971  -            "0": (#struct){
   972  -              #in: (_){ _ }
   973  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   974  -              out: (int){ 1 }
   975  -            }
   976  -            "1": (#struct){
   977  -              #in: (_){ _ }
   978  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   979  -              out: (int){ 1 }
   980  -            }
   981  -            "2": (#struct){
   982  -              #in: (_){ _ }
   983  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   984  -              out: (int){ 1 }
   985  -            }
   986  -            "3": (#struct){
   987  -              #in: (_){ _ }
   988  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   989  -              out: (int){ 1 }
   990  -            }
   991  -          }
   992  -          #in: (_){ _ }
   993  -          #basic: ((null|string)){ |((string){ string }, (null){ null }) }
   994  -          out: (int){ 1 }
   995  -        }
   996  -        #DepthF: (#struct){
   997  -          #next: (_){ _ }
   998  -          #func: (#struct){
   999  -            #in: (_){ _ }
  1000  -            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1001  -            out: (int){ 1 }
  1002  -          }
  1003  -        }
  1004  -        tree: (string){ "bar" }
  1005  -        d: (#struct){
  1006  -          #maxiter: (int){ 4 }
  1007  -          #funcs: (#struct){
  1008  -            "4": (null){ null }
  1009  -            "0": (#struct){
  1010  -              #in: (_){ _ }
  1011  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1012  -              out: (int){ 1 }
  1013  -            }
  1014  -            "1": (#struct){
  1015  -              #in: (_){ _ }
  1016  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1017  -              out: (int){ 1 }
  1018  -            }
  1019  -            "2": (#struct){
  1020  -              #in: (_){ _ }
  1021  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1022  -              out: (int){ 1 }
  1023  -            }
  1024  -            "3": (#struct){
  1025  -              #in: (_){ _ }
  1026  -              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1027  -              out: (int){ 1 }
  1028  -            }
  1029  -          }
  1030  -          #in: (string){ "bar" }
  1031  +          #in: (string){ "bar" }
  1032  +          #maxiter: (int){ 4 }
  1033  +          #funcs: (#struct){
  1034  +            "4": (null){ null }
  1035  +            "0": (#struct){
  1036  +              #in: (_){ _ }
  1037  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1038  +              out: (int){ 1 }
  1039  +            }
  1040  +            "1": (#struct){
  1041  +              #in: (_){ _ }
  1042  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1043  +              out: (int){ 1 }
  1044  +            }
  1045  +            "2": (#struct){
  1046  +              #in: (_){ _ }
  1047  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1048  +              out: (int){ 1 }
  1049  +            }
  1050  +            "3": (#struct){
  1051  +              #in: (_){ _ }
  1052  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1053  +              out: (int){ 1 }
  1054  +            }
  1055  +          }
  1056  +          #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1057  +          out: (int){ 1 }
  1058  +        }
  1059  +      }
  1060  +      t2: (struct){
  1061  +        #Depth: (#struct){
  1062  +          #maxiter: (int){ 4 }
  1063  +          #funcs: (#struct){
  1064  +            "4": (null){ null }
  1065  +            "0": (#struct){
  1066  +              #in: (_){ _ }
  1067  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1068  +              out: (int){ 1 }
  1069  +            }
  1070  +            "1": (#struct){
  1071  +              #in: (_){ _ }
  1072  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1073  +              out: (int){ 1 }
  1074  +            }
  1075  +            "2": (#struct){
  1076  +              #in: (_){ _ }
  1077  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1078  +              out: (int){ 1 }
  1079  +            }
  1080  +            "3": (#struct){
  1081  +              #in: (_){ _ }
  1082  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1083  +              out: (int){ 1 }
  1084  +            }
  1085  +          }
  1086  +          #in: (_){ _ }
  1087  +          #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1088  +          out: (int){ 1 }
  1089  +        }
  1090  +        #DepthF: (#struct){
  1091  +          #next: (_){ _ }
  1092  +          #func: (#struct){
  1093  +            #in: (_){ _ }
  1094  +            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1095  +            out: (int){ 1 }
  1096  +          }
  1097  +        }
  1098  +        tree: (string){ "bar" }
  1099  +        d: (#struct){
  1100  +          #in: (string){ "bar" }
  1101  +          #maxiter: (int){ 4 }
  1102  +          #funcs: (#struct){
  1103  +            "4": (null){ null }
  1104  +            "0": (#struct){
  1105  +              #in: (_){ _ }
  1106  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1107  +              out: (int){ 1 }
  1108  +            }
  1109  +            "1": (#struct){
  1110  +              #in: (_){ _ }
  1111  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1112  +              out: (int){ 1 }
  1113  +            }
  1114  +            "2": (#struct){
  1115  +              #in: (_){ _ }
  1116  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1117  +              out: (int){ 1 }
  1118  +            }
  1119  +            "3": (#struct){
  1120  +              #in: (_){ _ }
  1121  +              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1122  +              out: (int){ 1 }
  1123  +            }
  1124  +          }
  1125             #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1126             out: (int){ 1 }
  1127           }
  1128  @@ -245,7 +237,13 @@
  1129             #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1130             out: (int){
  1131               1
  1132  -            let depths#1 = (_){ _ }
  1133  +            let depths#1multi = [
  1134  +              for k, v in 〈3;#in〉 {
  1135  +                (〈6;#next〉 & {
  1136  +                  #in: 〈2;v〉
  1137  +                }).out
  1138  +              },
  1139  +            ]
  1140             }
  1141           }
  1142         }
  1143  @@ -258,98 +256,170 @@
  1144               #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1145               out: (int){
  1146                 1
  1147  -              let depths#1 = (_){ _ }
  1148  -            }
  1149  -          }
  1150  -        }
  1151  -        #funcs: (#struct){
  1152  -          "11": (null){ null }
  1153  -          "0": (#struct){
  1154  -            #in: (_){ _ }
  1155  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1156  -            out: (int){
  1157  -              1
  1158  -              let depths#1 = (_){ _ }
  1159  -            }
  1160  -          }
  1161  -          "1": (#struct){
  1162  -            #in: (_){ _ }
  1163  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1164  -            out: (int){
  1165  -              1
  1166  -              let depths#1 = (_){ _ }
  1167  -            }
  1168  -          }
  1169  -          "2": (#struct){
  1170  -            #in: (_){ _ }
  1171  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1172  -            out: (int){
  1173  -              1
  1174  -              let depths#1 = (_){ _ }
  1175  -            }
  1176  -          }
  1177  -          "3": (#struct){
  1178  -            #in: (_){ _ }
  1179  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1180  -            out: (int){
  1181  -              1
  1182  -              let depths#1 = (_){ _ }
  1183  -            }
  1184  -          }
  1185  -          "4": (#struct){
  1186  -            #in: (_){ _ }
  1187  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1188  -            out: (int){
  1189  -              1
  1190  -              let depths#1 = (_){ _ }
  1191  -            }
  1192  -          }
  1193  -          "5": (#struct){
  1194  -            #in: (_){ _ }
  1195  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1196  -            out: (int){
  1197  -              1
  1198  -              let depths#1 = (_){ _ }
  1199  -            }
  1200  -          }
  1201  -          "6": (#struct){
  1202  -            #in: (_){ _ }
  1203  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1204  -            out: (int){
  1205  -              1
  1206  -              let depths#1 = (_){ _ }
  1207  -            }
  1208  -          }
  1209  -          "7": (#struct){
  1210  -            #in: (_){ _ }
  1211  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1212  -            out: (int){
  1213  -              1
  1214  -              let depths#1 = (_){ _ }
  1215  -            }
  1216  -          }
  1217  -          "8": (#struct){
  1218  -            #in: (_){ _ }
  1219  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1220  -            out: (int){
  1221  -              1
  1222  -              let depths#1 = (_){ _ }
  1223  -            }
  1224  -          }
  1225  -          "9": (#struct){
  1226  -            #in: (_){ _ }
  1227  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1228  -            out: (int){
  1229  -              1
  1230  -              let depths#1 = (_){ _ }
  1231  -            }
  1232  -          }
  1233  -          "10": (#struct){
  1234  -            #in: (_){ _ }
  1235  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1236  -            out: (int){
  1237  -              1
  1238  -              let depths#1 = (_){ _ }
  1239  +              let depths#1multi = [
  1240  +                for k, v in 〈3;#in〉 {
  1241  +                  (〈6;#next〉 & {
  1242  +                    #in: 〈2;v〉
  1243  +                  }).out
  1244  +                },
  1245  +              ]
  1246  +            }
  1247  +          }
  1248  +        }
  1249  +        #funcs: (#struct){
  1250  +          "11": (null){ null }
  1251  +          "0": (#struct){
  1252  +            #in: (_){ _ }
  1253  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1254  +            out: (int){
  1255  +              1
  1256  +              let depths#1multi = [
  1257  +                for k, v in 〈3;#in〉 {
  1258  +                  (〈6;#next〉 & {
  1259  +                    #in: 〈2;v〉
  1260  +                  }).out
  1261  +                },
  1262  +              ]
  1263  +            }
  1264  +          }
  1265  +          "1": (#struct){
  1266  +            #in: (_){ _ }
  1267  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1268  +            out: (int){
  1269  +              1
  1270  +              let depths#1multi = [
  1271  +                for k, v in 〈3;#in〉 {
  1272  +                  (〈6;#next〉 & {
  1273  +                    #in: 〈2;v〉
  1274  +                  }).out
  1275  +                },
  1276  +              ]
  1277  +            }
  1278  +          }
  1279  +          "2": (#struct){
  1280  +            #in: (_){ _ }
  1281  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1282  +            out: (int){
  1283  +              1
  1284  +              let depths#1multi = [
  1285  +                for k, v in 〈3;#in〉 {
  1286  +                  (〈6;#next〉 & {
  1287  +                    #in: 〈2;v〉
  1288  +                  }).out
  1289  +                },
  1290  +              ]
  1291  +            }
  1292  +          }
  1293  +          "3": (#struct){
  1294  +            #in: (_){ _ }
  1295  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1296  +            out: (int){
  1297  +              1
  1298  +              let depths#1multi = [
  1299  +                for k, v in 〈3;#in〉 {
  1300  +                  (〈6;#next〉 & {
  1301  +                    #in: 〈2;v〉
  1302  +                  }).out
  1303  +                },
  1304  +              ]
  1305  +            }
  1306  +          }
  1307  +          "4": (#struct){
  1308  +            #in: (_){ _ }
  1309  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1310  +            out: (int){
  1311  +              1
  1312  +              let depths#1multi = [
  1313  +                for k, v in 〈3;#in〉 {
  1314  +                  (〈6;#next〉 & {
  1315  +                    #in: 〈2;v〉
  1316  +                  }).out
  1317  +                },
  1318  +              ]
  1319  +            }
  1320  +          }
  1321  +          "5": (#struct){
  1322  +            #in: (_){ _ }
  1323  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1324  +            out: (int){
  1325  +              1
  1326  +              let depths#1multi = [
  1327  +                for k, v in 〈3;#in〉 {
  1328  +                  (〈6;#next〉 & {
  1329  +                    #in: 〈2;v〉
  1330  +                  }).out
  1331  +                },
  1332  +              ]
  1333  +            }
  1334  +          }
  1335  +          "6": (#struct){
  1336  +            #in: (_){ _ }
  1337  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1338  +            out: (int){
  1339  +              1
  1340  +              let depths#1multi = [
  1341  +                for k, v in 〈3;#in〉 {
  1342  +                  (〈6;#next〉 & {
  1343  +                    #in: 〈2;v〉
  1344  +                  }).out
  1345  +                },
  1346  +              ]
  1347  +            }
  1348  +          }
  1349  +          "7": (#struct){
  1350  +            #in: (_){ _ }
  1351  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1352  +            out: (int){
  1353  +              1
  1354  +              let depths#1multi = [
  1355  +                for k, v in 〈3;#in〉 {
  1356  +                  (〈6;#next〉 & {
  1357  +                    #in: 〈2;v〉
  1358  +                  }).out
  1359  +                },
  1360  +              ]
  1361  +            }
  1362  +          }
  1363  +          "8": (#struct){
  1364  +            #in: (_){ _ }
  1365  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1366  +            out: (int){
  1367  +              1
  1368  +              let depths#1multi = [
  1369  +                for k, v in 〈3;#in〉 {
  1370  +                  (〈6;#next〉 & {
  1371  +                    #in: 〈2;v〉
  1372  +                  }).out
  1373  +                },
  1374  +              ]
  1375  +            }
  1376  +          }
  1377  +          "9": (#struct){
  1378  +            #in: (_){ _ }
  1379  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1380  +            out: (int){
  1381  +              1
  1382  +              let depths#1multi = [
  1383  +                for k, v in 〈3;#in〉 {
  1384  +                  (〈6;#next〉 & {
  1385  +                    #in: 〈2;v〉
  1386  +                  }).out
  1387  +                },
  1388  +              ]
  1389  +            }
  1390  +          }
  1391  +          "10": (#struct){
  1392  +            #in: (_){ _ }
  1393  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1394  +            out: (int){
  1395  +              1
  1396  +              let depths#1multi = [
  1397  +                for k, v in 〈3;#in〉 {
  1398  +                  (〈6;#next〉 & {
  1399  +                    #in: 〈2;v〉
  1400  +                  }).out
  1401  +                },
  1402  +              ]
  1403               }
  1404             }
  1405           }
  1406  @@ -357,7 +427,13 @@
  1407           #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1408           out: (int){
  1409             1
  1410  -          let depths#1 = (_){ _ }
  1411  +          let depths#1multi = [
  1412  +            for k, v in 〈3;#in〉 {
  1413  +              (〈6;#next〉 & {
  1414  +                #in: 〈2;v〉
  1415  +              }).out
  1416  +            },
  1417  +          ]
  1418           }
  1419         }
  1420         tree: (struct){
  1421  @@ -371,49 +447,7 @@
  1422           }
  1423           cow: (string){ "moo" }
  1424         }
  1425  -      d: (_|_){
  1426  -        // [incomplete] issue2052.full.d: cannot add field #maxiter: was already used:
  1427  -        //     ./issue2052.cue:143:23
  1428  -        #maxiter: (int){ |(*(int){ 4 }, (int){ &(>=0, int) }) }
  1429  -        #funcFactory: (#struct){
  1430  -          #next: (_){ _ }
  1431  -          #func: (#struct){
  1432  -            #in: (_){ _ }
  1433  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1434  -            out: (int){
  1435  -              1
  1436  -              let depths#1 = (_){ _ }
  1437  -            }
  1438  -          }
  1439  -        }
  1440  -        #funcs: (#struct){
  1441  -          "4": (null){ null }
  1442  -          "0": (_){ _ }
  1443  -          "1": (#struct){
  1444  -            #in: (_){ _ }
  1445  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1446  -            out: (int){
  1447  -              1
  1448  -              let depths#1 = (_){ _ }
  1449  -            }
  1450  -          }
  1451  -          "2": (#struct){
  1452  -            #in: (_){ _ }
  1453  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1454  -            out: (int){
  1455  -              1
  1456  -              let depths#1 = (_){ _ }
  1457  -            }
  1458  -          }
  1459  -          "3": (#struct){
  1460  -            #in: (_){ _ }
  1461  -            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1462  -            out: (int){
  1463  -              1
  1464  -              let depths#1 = (_){ _ }
  1465  -            }
  1466  -          }
  1467  -        }
  1468  +      d: (#struct){
  1469           #in: (#struct){
  1470             a: (#struct){
  1471               foo: (string){ "bar" }
  1472  @@ -425,6 +459,192 @@
  1473             }
  1474             cow: (string){ "moo" }
  1475           }
  1476  +        #maxiter: (int){ 11 }
  1477  +        #funcFactory: (#struct){
  1478  +          #next: (_){ _ }
  1479  +          #func: (#struct){
  1480  +            #in: (_){ _ }
  1481  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1482  +            out: (int){
  1483  +              1
  1484  +              let depths#1multi = [
  1485  +                for k, v in 〈3;#in〉 {
  1486  +                  (〈6;#next〉 & {
  1487  +                    #in: 〈2;v〉
  1488  +                  }).out
  1489  +                },
  1490  +              ]
  1491  +            }
  1492  +          }
  1493  +        }
  1494  +        #funcs: (#struct){
  1495  +          "11": (null){ null }
  1496  +          "0": (#struct){
  1497  +            #in: (_){ _ }
  1498  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1499  +            out: (int){
  1500  +              1
  1501  +              let depths#1multi = [
  1502  +                for k, v in 〈3;#in〉 {
  1503  +                  (〈6;#next〉 & {
  1504  +                    #in: 〈2;v〉
  1505  +                  }).out
  1506  +                },
  1507  +              ]
  1508  +            }
  1509  +          }
  1510  +          "1": (#struct){
  1511  +            #in: (_){ _ }
  1512  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1513  +            out: (int){
  1514  +              1
  1515  +              let depths#1multi = [
  1516  +                for k, v in 〈3;#in〉 {
  1517  +                  (〈6;#next〉 & {
  1518  +                    #in: 〈2;v〉
  1519  +                  }).out
  1520  +                },
  1521  +              ]
  1522  +            }
  1523  +          }
  1524  +          "2": (#struct){
  1525  +            #in: (_){ _ }
  1526  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1527  +            out: (int){
  1528  +              1
  1529  +              let depths#1multi = [
  1530  +                for k, v in 〈3;#in〉 {
  1531  +                  (〈6;#next〉 & {
  1532  +                    #in: 〈2;v〉
  1533  +                  }).out
  1534  +                },
  1535  +              ]
  1536  +            }
  1537  +          }
  1538  +          "3": (#struct){
  1539  +            #in: (_){ _ }
  1540  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1541  +            out: (int){
  1542  +              1
  1543  +              let depths#1multi = [
  1544  +                for k, v in 〈3;#in〉 {
  1545  +                  (〈6;#next〉 & {
  1546  +                    #in: 〈2;v〉
  1547  +                  }).out
  1548  +                },
  1549  +              ]
  1550  +            }
  1551  +          }
  1552  +          "4": (#struct){
  1553  +            #in: (_){ _ }
  1554  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1555  +            out: (int){
  1556  +              1
  1557  +              let depths#1multi = [
  1558  +                for k, v in 〈3;#in〉 {
  1559  +                  (〈6;#next〉 & {
  1560  +                    #in: 〈2;v〉
  1561  +                  }).out
  1562  +                },
  1563  +              ]
  1564  +            }
  1565  +          }
  1566  +          "5": (#struct){
  1567  +            #in: (_){ _ }
  1568  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1569  +            out: (int){
  1570  +              1
  1571  +              let depths#1multi = [
  1572  +                for k, v in 〈3;#in〉 {
  1573  +                  (〈6;#next〉 & {
  1574  +                    #in: 〈2;v〉
  1575  +                  }).out
  1576  +                },
  1577  +              ]
  1578  +            }
  1579  +          }
  1580  +          "6": (#struct){
  1581  +            #in: (_){ _ }
  1582  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1583  +            out: (int){
  1584  +              1
  1585  +              let depths#1multi = [
  1586  +                for k, v in 〈3;#in〉 {
  1587  +                  (〈6;#next〉 & {
  1588  +                    #in: 〈2;v〉
  1589  +                  }).out
  1590  +                },
  1591  +              ]
  1592  +            }
  1593  +          }
  1594  +          "7": (#struct){
  1595  +            #in: (_){ _ }
  1596  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1597  +            out: (int){
  1598  +              1
  1599  +              let depths#1multi = [
  1600  +                for k, v in 〈3;#in〉 {
  1601  +                  (〈6;#next〉 & {
  1602  +                    #in: 〈2;v〉
  1603  +                  }).out
  1604  +                },
  1605  +              ]
  1606  +            }
  1607  +          }
  1608  +          "8": (#struct){
  1609  +            #in: (_){ _ }
  1610  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1611  +            out: (int){
  1612  +              1
  1613  +              let depths#1multi = [
  1614  +                for k, v in 〈3;#in〉 {
  1615  +                  (〈6;#next〉 & {
  1616  +                    #in: 〈2;v〉
  1617  +                  }).out
  1618  +                },
  1619  +              ]
  1620  +            }
  1621  +          }
  1622  +          "9": (#struct){
  1623  +            #in: (_){ _ }
  1624  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1625  +            out: (int){
  1626  +              1
  1627  +              let depths#1multi = [
  1628  +                for k, v in 〈3;#in〉 {
  1629  +                  (〈6;#next〉 & {
  1630  +                    #in: 〈2;v〉
  1631  +                  }).out
  1632  +                },
  1633  +              ]
  1634  +            }
  1635  +          }
  1636  +          "10": (#struct){
  1637  +            #in: (_){ _ }
  1638  +            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1639  +            out: (int){
  1640  +              1
  1641  +              let depths#1multi = [
  1642  +                for k, v in 〈3;#in〉 {
  1643  +                  (〈6;#next〉 & {
  1644  +                    #in: 〈2;v〉
  1645  +                  }).out
  1646  +                },
  1647  +              ]
  1648  +            }
  1649  +          }
  1650  +        }
  1651  +        #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1652  +        out: (int){
  1653  +          5
  1654  +          let depths#1multi = [
  1655  +            for k, v in 〈3;#in〉 {
  1656  +              (〈6;#next〉 & {
  1657  +                #in: 〈2;v〉
  1658  +              }).out
  1659  +            },
  1660  +          ]
  1661  +        }
  1662         }
  1663       }
  1664     }
  1665  -- out/evalalpha/stats --
  1666  Leaks:  3149
  1667  Freed:  0
  1668  Reused: 0
  1669  Allocs: 3149
  1670  Retain: 0
  1671  
  1672  Unifications: 940
  1673  Conjuncts:    5024
  1674  Disjuncts:    1615
  1675  
  1676  CloseIDElems: 20500
  1677  NumCloseIDs: 1548
  1678  -- diff/-out/evalalpha/stats<==>+out/eval/stats --
  1679  diff old new
  1680  --- old
  1681  +++ new
  1682  @@ -1,9 +1,12 @@
  1683  -Leaks:  56
  1684  -Freed:  1788
  1685  -Reused: 1774
  1686  -Allocs: 70
  1687  -Retain: 174
  1688  -
  1689  -Unifications: 759
  1690  -Conjuncts:    3139
  1691  -Disjuncts:    1942
  1692  +Leaks:  3149
  1693  +Freed:  0
  1694  +Reused: 0
  1695  +Allocs: 3149
  1696  +Retain: 0
  1697  +
  1698  +Unifications: 940
  1699  +Conjuncts:    5024
  1700  +Disjuncts:    1615
  1701  +
  1702  +CloseIDElems: 20500
  1703  +NumCloseIDs: 1548
  1704  -- out/eval/stats --
  1705  Leaks:  56
  1706  Freed:  1788
  1707  Reused: 1774
  1708  Allocs: 70
  1709  Retain: 174
  1710  
  1711  Unifications: 759
  1712  Conjuncts:    3139
  1713  Disjuncts:    1942
  1714  -- out/eval --
  1715  (struct){
  1716    chain: (struct){
  1717      t1: (struct){
  1718        #maxiter: (int){ 2 }
  1719        x: (#struct){
  1720        }
  1721        a: (struct){
  1722          x2: (null){ null }
  1723          x0: (#struct){
  1724          }
  1725          x1: (#struct){
  1726          }
  1727        }
  1728        #DepthF: (#struct){
  1729          #in: (_){ _ }
  1730          #out: (#struct){
  1731          }
  1732        }
  1733      }
  1734      t2: (struct){
  1735        p1: (struct){
  1736          X: (int){ 1 }
  1737          x: (struct){
  1738            x0: (struct){
  1739            }
  1740            x1: (struct){
  1741            }
  1742          }
  1743        }
  1744        p2: (_|_){
  1745          // [incomplete] chain.t2.p2.0.1: invalid interpolation: cycle error referencing X:
  1746          //     ./in.cue:44:6
  1747          //     ./in.cue:43:28
  1748          x: (_|_){
  1749            // [incomplete] chain.t2.p2.0.1: invalid interpolation: cycle error referencing X:
  1750            //     ./in.cue:44:6
  1751            //     ./in.cue:43:28
  1752            x0: (struct){
  1753            }
  1754          }
  1755          X: (int){ 1 }
  1756        }
  1757      }
  1758      t3: (struct){
  1759        p1: (struct){
  1760          X: (int){ 1 }
  1761          x: (struct){
  1762            x0: (struct){
  1763            }
  1764          }
  1765        }
  1766      }
  1767    }
  1768    issue2052: (struct){
  1769      reduced: (struct){
  1770        t1: (struct){
  1771          A: (struct){
  1772            a: (_){ _ }
  1773          }
  1774          Depth: (struct){
  1775            #maxiter: (int){ 1 }
  1776            funcs: (struct){
  1777              "0": (struct){
  1778                a: (_){ _ }
  1779              }
  1780            }
  1781            a: (_){ _ }
  1782          }
  1783        }
  1784        t2: (struct){
  1785          A: (struct){
  1786            a: (_){ _ }
  1787          }
  1788          Depth: (struct){
  1789            maxiter: (int){ 1 }
  1790            funcs: (struct){
  1791              "0": (struct){
  1792                a: (_){ _ }
  1793              }
  1794            }
  1795            a: (_){ _ }
  1796          }
  1797        }
  1798      }
  1799      medium: (struct){
  1800        t1: (struct){
  1801          #Depth: (#struct){
  1802            #maxiter: (int){ 4 }
  1803            #funcs: (#struct){
  1804              "4": (null){ null }
  1805              "0": (#struct){
  1806                #in: (_){ _ }
  1807                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1808                out: (int){ 1 }
  1809              }
  1810              "1": (#struct){
  1811                #in: (_){ _ }
  1812                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1813                out: (int){ 1 }
  1814              }
  1815              "2": (#struct){
  1816                #in: (_){ _ }
  1817                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1818                out: (int){ 1 }
  1819              }
  1820              "3": (#struct){
  1821                #in: (_){ _ }
  1822                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1823                out: (int){ 1 }
  1824              }
  1825            }
  1826            #in: (_){ _ }
  1827            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1828            out: (int){ 1 }
  1829          }
  1830          #DepthF: (#struct){
  1831            #next: (_){ _ }
  1832            #func: (#struct){
  1833              #in: (_){ _ }
  1834              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1835              out: (int){ 1 }
  1836            }
  1837          }
  1838          tree: (string){ "bar" }
  1839          d: (#struct){
  1840            #maxiter: (int){ 4 }
  1841            #funcs: (#struct){
  1842              "4": (null){ null }
  1843              "0": (#struct){
  1844                #in: (_){ _ }
  1845                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1846                out: (int){ 1 }
  1847              }
  1848              "1": (#struct){
  1849                #in: (_){ _ }
  1850                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1851                out: (int){ 1 }
  1852              }
  1853              "2": (#struct){
  1854                #in: (_){ _ }
  1855                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1856                out: (int){ 1 }
  1857              }
  1858              "3": (#struct){
  1859                #in: (_){ _ }
  1860                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1861                out: (int){ 1 }
  1862              }
  1863            }
  1864            #in: (string){ "bar" }
  1865            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1866            out: (int){ 1 }
  1867          }
  1868        }
  1869        t2: (struct){
  1870          #Depth: (#struct){
  1871            #maxiter: (int){ 4 }
  1872            #funcs: (#struct){
  1873              "4": (null){ null }
  1874              "0": (#struct){
  1875                #in: (_){ _ }
  1876                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1877                out: (int){ 1 }
  1878              }
  1879              "1": (#struct){
  1880                #in: (_){ _ }
  1881                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1882                out: (int){ 1 }
  1883              }
  1884              "2": (#struct){
  1885                #in: (_){ _ }
  1886                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1887                out: (int){ 1 }
  1888              }
  1889              "3": (#struct){
  1890                #in: (_){ _ }
  1891                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1892                out: (int){ 1 }
  1893              }
  1894            }
  1895            #in: (_){ _ }
  1896            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1897            out: (int){ 1 }
  1898          }
  1899          #DepthF: (#struct){
  1900            #next: (_){ _ }
  1901            #func: (#struct){
  1902              #in: (_){ _ }
  1903              #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1904              out: (int){ 1 }
  1905            }
  1906          }
  1907          tree: (string){ "bar" }
  1908          d: (#struct){
  1909            #maxiter: (int){ 4 }
  1910            #funcs: (#struct){
  1911              "4": (null){ null }
  1912              "0": (#struct){
  1913                #in: (_){ _ }
  1914                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1915                out: (int){ 1 }
  1916              }
  1917              "1": (#struct){
  1918                #in: (_){ _ }
  1919                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1920                out: (int){ 1 }
  1921              }
  1922              "2": (#struct){
  1923                #in: (_){ _ }
  1924                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1925                out: (int){ 1 }
  1926              }
  1927              "3": (#struct){
  1928                #in: (_){ _ }
  1929                #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1930                out: (int){ 1 }
  1931              }
  1932            }
  1933            #in: (string){ "bar" }
  1934            #basic: ((null|string)){ |((string){ string }, (null){ null }) }
  1935            out: (int){ 1 }
  1936          }
  1937        }
  1938      }
  1939      full: (struct){
  1940        #RecurseN: (_){
  1941          _
  1942          #maxiter: (int){ |(*(int){ 4 }, (int){ &(>=0, int) }) }
  1943          #funcFactory: (#struct){
  1944            #next: (_){ _ }
  1945            #func: (_){ _ }
  1946          }
  1947          #funcs: (#struct){
  1948            "4": (null){ null }
  1949            "0": (_){ _ }
  1950            "1": (_){ _ }
  1951            "2": (_){ _ }
  1952            "3": (_){ _ }
  1953          }
  1954        }
  1955        #DepthF: (#struct){
  1956          #next: (_){ _ }
  1957          #func: (#struct){
  1958            #in: (_){ _ }
  1959            #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1960            out: (int){
  1961              1
  1962              let depths#1 = (_){ _ }
  1963            }
  1964          }
  1965        }
  1966        #Depth: (#struct){
  1967          #maxiter: (int){ 11 }
  1968          #funcFactory: (#struct){
  1969            #next: (_){ _ }
  1970            #func: (#struct){
  1971              #in: (_){ _ }
  1972              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1973              out: (int){
  1974                1
  1975                let depths#1 = (_){ _ }
  1976              }
  1977            }
  1978          }
  1979          #funcs: (#struct){
  1980            "11": (null){ null }
  1981            "0": (#struct){
  1982              #in: (_){ _ }
  1983              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1984              out: (int){
  1985                1
  1986                let depths#1 = (_){ _ }
  1987              }
  1988            }
  1989            "1": (#struct){
  1990              #in: (_){ _ }
  1991              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  1992              out: (int){
  1993                1
  1994                let depths#1 = (_){ _ }
  1995              }
  1996            }
  1997            "2": (#struct){
  1998              #in: (_){ _ }
  1999              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2000              out: (int){
  2001                1
  2002                let depths#1 = (_){ _ }
  2003              }
  2004            }
  2005            "3": (#struct){
  2006              #in: (_){ _ }
  2007              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2008              out: (int){
  2009                1
  2010                let depths#1 = (_){ _ }
  2011              }
  2012            }
  2013            "4": (#struct){
  2014              #in: (_){ _ }
  2015              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2016              out: (int){
  2017                1
  2018                let depths#1 = (_){ _ }
  2019              }
  2020            }
  2021            "5": (#struct){
  2022              #in: (_){ _ }
  2023              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2024              out: (int){
  2025                1
  2026                let depths#1 = (_){ _ }
  2027              }
  2028            }
  2029            "6": (#struct){
  2030              #in: (_){ _ }
  2031              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2032              out: (int){
  2033                1
  2034                let depths#1 = (_){ _ }
  2035              }
  2036            }
  2037            "7": (#struct){
  2038              #in: (_){ _ }
  2039              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2040              out: (int){
  2041                1
  2042                let depths#1 = (_){ _ }
  2043              }
  2044            }
  2045            "8": (#struct){
  2046              #in: (_){ _ }
  2047              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2048              out: (int){
  2049                1
  2050                let depths#1 = (_){ _ }
  2051              }
  2052            }
  2053            "9": (#struct){
  2054              #in: (_){ _ }
  2055              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2056              out: (int){
  2057                1
  2058                let depths#1 = (_){ _ }
  2059              }
  2060            }
  2061            "10": (#struct){
  2062              #in: (_){ _ }
  2063              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2064              out: (int){
  2065                1
  2066                let depths#1 = (_){ _ }
  2067              }
  2068            }
  2069          }
  2070          #in: (_){ _ }
  2071          #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2072          out: (int){
  2073            1
  2074            let depths#1 = (_){ _ }
  2075          }
  2076        }
  2077        tree: (struct){
  2078          a: (struct){
  2079            foo: (string){ "bar" }
  2080            a: (struct){
  2081              b: (struct){
  2082                c: (string){ "d" }
  2083              }
  2084            }
  2085          }
  2086          cow: (string){ "moo" }
  2087        }
  2088        d: (_|_){
  2089          // [incomplete] issue2052.full.d: cannot add field #maxiter: was already used:
  2090          //     ./issue2052.cue:143:23
  2091          #maxiter: (int){ |(*(int){ 4 }, (int){ &(>=0, int) }) }
  2092          #funcFactory: (#struct){
  2093            #next: (_){ _ }
  2094            #func: (#struct){
  2095              #in: (_){ _ }
  2096              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2097              out: (int){
  2098                1
  2099                let depths#1 = (_){ _ }
  2100              }
  2101            }
  2102          }
  2103          #funcs: (#struct){
  2104            "4": (null){ null }
  2105            "0": (_){ _ }
  2106            "1": (#struct){
  2107              #in: (_){ _ }
  2108              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2109              out: (int){
  2110                1
  2111                let depths#1 = (_){ _ }
  2112              }
  2113            }
  2114            "2": (#struct){
  2115              #in: (_){ _ }
  2116              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2117              out: (int){
  2118                1
  2119                let depths#1 = (_){ _ }
  2120              }
  2121            }
  2122            "3": (#struct){
  2123              #in: (_){ _ }
  2124              #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) }
  2125              out: (int){
  2126                1
  2127                let depths#1 = (_){ _ }
  2128              }
  2129            }
  2130          }
  2131          #in: (#struct){
  2132            a: (#struct){
  2133              foo: (string){ "bar" }
  2134              a: (#struct){
  2135                b: (#struct){
  2136                  c: (string){ "d" }
  2137                }
  2138              }
  2139            }
  2140            cow: (string){ "moo" }
  2141          }
  2142        }
  2143      }
  2144    }
  2145  }
  2146  -- out/compile --
  2147  --- in.cue
  2148  {
  2149    chain: {
  2150      t1: {
  2151        #maxiter: 2
  2152        x: 〈0;a〉.x0
  2153        a: {
  2154          for k, _ in [
  2155            0,
  2156            1,
  2157          ] {
  2158            "x\(〈1;k〉)": (〈3;#DepthF〉 & {
  2159              #in: 〈4;a〉["x\((〈2;k〉 + 1))"]
  2160            }).#out
  2161          }
  2162        }
  2163        a: {
  2164          x2: null
  2165        }
  2166        #DepthF: {
  2167          #in: _
  2168          #out: {}
  2169        }
  2170      }
  2171    }
  2172    chain: {
  2173      t2: {
  2174        p1: {
  2175          X: 1
  2176          for _, v in 〈import;list〉.Concat([
  2177            [
  2178              0,
  2179              〈2;X〉,
  2180            ],
  2181            [],
  2182          ]) {
  2183            x: {
  2184              "x\(〈2;v〉)": {}
  2185            }
  2186          }
  2187          x: _
  2188          〈0;x〉.x0
  2189        }
  2190      }
  2191    }
  2192    chain: {
  2193      t2: {
  2194        p2: {
  2195          for _, v in 〈import;list〉.Concat([
  2196            [
  2197              0,
  2198              〈2;X〉,
  2199            ],
  2200            [],
  2201          ]) {
  2202            x: {
  2203              "x\(〈2;v〉)": {}
  2204            }
  2205          }
  2206          x: _
  2207          〈0;x〉.x0
  2208          X: 1
  2209        }
  2210      }
  2211    }
  2212    chain: {
  2213      t3: {
  2214        p1: {
  2215          X: 1
  2216          for _, v in 〈import;list〉.Range(0, 〈0;X〉, 1) {
  2217            x: {
  2218              "x\(〈2;v〉)": {}
  2219            }
  2220          }
  2221          x: _
  2222          〈0;x〉.x0
  2223        }
  2224      }
  2225    }
  2226    chain: {
  2227      t3: {
  2228        p1: {
  2229          for _, v in 〈import;list〉.Range(0, 〈0;X〉, 1) {
  2230            x: {
  2231              "x\(〈2;v〉)": {}
  2232            }
  2233          }
  2234          x: _
  2235          〈0;x〉.x0
  2236          X: 1
  2237        }
  2238      }
  2239    }
  2240  }
  2241  --- issue2052.cue
  2242  {
  2243    issue2052: {
  2244      reduced: {
  2245        t1: {
  2246          A: {
  2247            a: _
  2248          }
  2249          Depth: {
  2250            #maxiter: 1
  2251            if (〈import;math〉.Abs(〈0;#maxiter〉) == 1) {
  2252              funcs: {
  2253                "\(0)": 〈3;A〉
  2254              }
  2255            }
  2256            funcs: {}
  2257            〈0;funcs〉["0"]
  2258          }
  2259        }
  2260      }
  2261    }
  2262    issue2052: {
  2263      reduced: {
  2264        t2: {
  2265          A: {
  2266            a: _
  2267          }
  2268          Depth: {
  2269            maxiter: 1
  2270            for k, v in 〈import;list〉.Range(0, 〈0;maxiter〉, 1) {
  2271              funcs: {
  2272                "\(0)": 〈4;A〉
  2273              }
  2274            }
  2275            funcs: {}
  2276            〈0;funcs〉["0"]
  2277          }
  2278        }
  2279      }
  2280    }
  2281    issue2052: {
  2282      medium: {
  2283        t1: {
  2284          #Depth: {
  2285            #maxiter: 4
  2286            for k, v in 〈import;list〉.Range(0, 〈0;#maxiter〉, 1) {
  2287              #funcs: {
  2288                "\(〈2;k〉)": (〈4;#DepthF〉 & {
  2289                  #next: 〈2;#funcs〉["\((〈3;k〉 + 1))"]
  2290                }).#func
  2291              }
  2292            }
  2293            #funcs: {
  2294              "\(〈1;#maxiter〉)": null
  2295            }
  2296            〈0;#funcs〉["0"]
  2297          }
  2298          #DepthF: {
  2299            #next: _
  2300            #func: {
  2301              #in: _
  2302              #basic: (string|null)
  2303              out: {
  2304                if ((〈1;#in〉 & 〈1;#basic〉) != _|_(explicit error (_|_ literal) in source)) {
  2305                  1
  2306                }
  2307                if ((〈1;#in〉 & 〈1;#basic〉) == _|_(explicit error (_|_ literal) in source)) {
  2308                  (〈import;list〉.Max([
  2309                    for k, v in 〈3;#in〉 {
  2310                      (〈6;#next〉 & {
  2311                        #in: 〈2;v〉
  2312                      }).out
  2313                    },
  2314                  ]) + 1)
  2315                }
  2316              }
  2317            }
  2318          }
  2319          tree: "bar"
  2320          d: (〈0;#Depth〉 & {
  2321            #in: 〈1;tree〉
  2322          })
  2323        }
  2324      }
  2325    }
  2326    issue2052: {
  2327      medium: {
  2328        t2: {
  2329          #Depth: {
  2330            #maxiter: 4
  2331            for k, v in 〈import;list〉.Range(0, 〈0;#maxiter〉, 1) {
  2332              #funcs: {
  2333                "\(〈2;k〉)": (〈4;#DepthF〉 & {
  2334                  #next: 〈2;#funcs〉["\((〈3;k〉 + 1))"]
  2335                }).#func
  2336              }
  2337            }
  2338            #funcs: {
  2339              for k, v in 〈import;list〉.Range(0, 〈1;#maxiter〉, 1) {
  2340                "\(〈1;k〉)": (〈4;#DepthF〉 & {
  2341                  #next: 〈4;#funcs〉["\((〈2;k〉 + 1))"]
  2342                }).#func
  2343              }
  2344            }
  2345            #funcs: {
  2346              "\(〈1;#maxiter〉)": null
  2347            }
  2348            〈0;#funcs〉["0"]
  2349          }
  2350          #DepthF: {
  2351            #next: _
  2352            #func: {
  2353              #in: _
  2354              #basic: (string|null)
  2355              out: {
  2356                if ((〈1;#in〉 & 〈1;#basic〉) != _|_(explicit error (_|_ literal) in source)) {
  2357                  1
  2358                }
  2359                if ((〈1;#in〉 & 〈1;#basic〉) == _|_(explicit error (_|_ literal) in source)) {
  2360                  (〈import;list〉.Max([
  2361                    for k, v in 〈3;#in〉 {
  2362                      (〈6;#next〉 & {
  2363                        #in: 〈2;v〉
  2364                      }).out
  2365                    },
  2366                  ]) + 1)
  2367                }
  2368              }
  2369            }
  2370          }
  2371          tree: "bar"
  2372          d: (〈0;#Depth〉 & {
  2373            #in: 〈1;tree〉
  2374          })
  2375        }
  2376      }
  2377    }
  2378    issue2052: {
  2379      full: {
  2380        #RecurseN: {
  2381          #maxiter: (&(int, >=0)|*4)
  2382          #funcFactory: {
  2383            #next: _
  2384            #func: _
  2385          }
  2386          for k, v in 〈import;list〉.Range(0, 〈0;#maxiter〉, 1) {
  2387            #funcs: {
  2388              "\(〈2;k〉)": (〈3;#funcFactory〉 & {
  2389                #next: 〈2;#funcs〉["\((〈3;k〉 + 1))"]
  2390              }).#func
  2391            }
  2392          }
  2393          #funcs: {
  2394            "\(〈1;#maxiter〉)": null
  2395          }
  2396          〈0;#funcs〉["0"]
  2397        }
  2398        #DepthF: {
  2399          #next: _
  2400          #func: {
  2401            #in: _
  2402            #basic: (int|number|string|bytes|null)
  2403            out: {
  2404              if ((〈1;#in〉 & 〈1;#basic〉) != _|_(explicit error (_|_ literal) in source)) {
  2405                1
  2406              }
  2407              if ((〈1;#in〉 & 〈1;#basic〉) == _|_(explicit error (_|_ literal) in source)) {
  2408                let depths#1 = [
  2409                  for k, v in 〈3;#in〉 {
  2410                    (〈6;#next〉 & {
  2411                      #in: 〈2;v〉
  2412                    }).out
  2413                  },
  2414                ]
  2415                (〈import;list〉.Max(〈0;let depths#1〉) + 1)
  2416              }
  2417            }
  2418          }
  2419        }
  2420        #Depth: (〈0;#RecurseN〉 & {
  2421          #maxiter: 11
  2422          #funcFactory: 〈1;#DepthF〉
  2423        })
  2424        tree: {
  2425          a: {
  2426            foo: "bar"
  2427            a: {
  2428              b: {
  2429                c: "d"
  2430              }
  2431            }
  2432          }
  2433          cow: "moo"
  2434        }
  2435        d: (〈0;#Depth〉 & {
  2436          #in: 〈1;tree〉
  2437        })
  2438      }
  2439    }
  2440  }