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

     1  -- in.cue --
     2  // All these cases whose name end with cycle should fail with a structural
     3  // error. These are all uncommon code paths, triggered when container types
     4  // are evalated within a nested expression such as as an argument to a
     5  // function call.
     6  //
     7  // The builtins are typically used to trigger the uncommon path. The choice of
     8  // builtin is irrelevant, as long as they don't finalize args before processing.
     9  
    10  import "list"
    11  
    12  // This is a resolvable reference cycle, were b is equated to c.
    13  letCycleOK: t1: {
    14  	b: c
    15  	let X = b
    16  	c: X
    17  }
    18  
    19  // The let has structural cycle, but it is only used in a way that the
    20  // structural cycle is avoided.
    21  letCycleOK: t2: {
    22  	a: {
    23  		b: 1
    24  		let X = a
    25  		c: X.b
    26  	}
    27  }
    28  
    29  // Ensure that the cycle exemption algorithm does not bypass actual structural
    30  // cycles.
    31  letCycleFail: t1: {
    32  	a: {
    33  		b: 1
    34  		let X = a
    35  		c: X
    36  	}
    37  }
    38  
    39  // Cycles should also be detected in evaluation paths that descend into
    40  // recursion at non-field boundaries.
    41  letCycleFail: t2: {
    42  	a: {
    43  		let X = a
    44  		if X == _|_ { }
    45  		x: y: ""
    46  	}
    47  }
    48  
    49  listCycleOK: {
    50  	a: b
    51  	b: and([c])
    52  	c: a
    53  }
    54  
    55  disjunctionCycle: {
    56  	a: b
    57  	b: and(1 | c)
    58  	c: a
    59  }
    60  
    61  forCycle: {
    62  	#A: a: #B // TODO(errors): Correct error position.
    63  	#B: or([for x in #A { b: x }])
    64  }
    65  
    66  letCycleWithAnd: {
    67  	a: d: b
    68  	b: and([for x in a let y = x { y }])
    69  	c: a
    70  }
    71  
    72  closeCycle: {
    73  	a: b
    74  	b: close({d: c})
    75  	c: a
    76  }
    77  
    78  structCycle: {
    79  	a: b
    80  	b: and([{d: c}])
    81  	c: a
    82  }
    83  
    84  embedCycle: {
    85  	a: b
    86  	b: close({c})
    87  	c: a
    88  }
    89  
    90  listAddCycle: {
    91  	a: b
    92  	b: list.Concat([[c], [c]])
    93  	c: a
    94  }
    95  
    96  listMulCycle: {
    97  	a: b
    98  	b: list.Repeat([{a: b: c}], 3)
    99  	c: a
   100  }
   101  
   102  // consult the correct closeness info in the face of it being passed down
   103  // from parent.
   104  closeFail: {
   105  	#T: [_]: _
   106  	#T: close({"a": string})
   107  	x:  #T
   108  	x: b: "foo"
   109  }
   110  
   111  printCycle: {
   112  	a: {
   113  		X: a
   114  		if X {
   115  		}
   116  	}
   117  }
   118  -- out/evalalpha/stats --
   119  Leaks:  119
   120  Freed:  0
   121  Reused: 0
   122  Allocs: 119
   123  Retain: 0
   124  
   125  Unifications: 99
   126  Conjuncts:    133
   127  Disjuncts:    5
   128  
   129  CloseIDElems: 11
   130  NumCloseIDs: 26
   131  -- diff/-out/evalalpha/stats<==>+out/eval/stats --
   132  diff old new
   133  --- old
   134  +++ new
   135  @@ -1,9 +1,12 @@
   136  -Leaks:  48
   137  -Freed:  127
   138  -Reused: 120
   139  -Allocs: 55
   140  -Retain: 138
   141  -
   142  -Unifications: 163
   143  -Conjuncts:    299
   144  -Disjuncts:    192
   145  +Leaks:  119
   146  +Freed:  0
   147  +Reused: 0
   148  +Allocs: 119
   149  +Retain: 0
   150  +
   151  +Unifications: 99
   152  +Conjuncts:    133
   153  +Disjuncts:    5
   154  +
   155  +CloseIDElems: 11
   156  +NumCloseIDs: 26
   157  -- out/eval/stats --
   158  Leaks:  48
   159  Freed:  127
   160  Reused: 120
   161  Allocs: 55
   162  Retain: 138
   163  
   164  Unifications: 163
   165  Conjuncts:    299
   166  Disjuncts:    192
   167  -- out/evalalpha --
   168  Errors:
   169  closeCycle.c: structural cycle
   170  closeFail.x.b: field not allowed:
   171      ./in.cue:104:6
   172      ./in.cue:107:5
   173  letCycleFail.t1.a.c: structural cycle
   174  printCycle.a.X: structural cycle
   175  structCycle.c: structural cycle
   176  disjunctionCycle.b: cannot use 1 (type int) as type list:
   177      ./in.cue:56:5
   178      ./in.cue:56:9
   179  b: structural cycle:
   180      ./in.cue:62:6
   181  listAddCycle.c: structural cycle:
   182      ./in.cue:91:5
   183  listMulCycle.c: structural cycle:
   184      ./in.cue:97:5
   185  
   186  Result:
   187  (_|_){
   188    // [eval]
   189    letCycleOK: (struct){
   190      t1: (struct){
   191        b: (_){ _ }
   192        let X#1 = (_){ _ }
   193        c: (_){ _ }
   194      }
   195      t2: (struct){
   196        a: (struct){
   197          b: (int){ 1 }
   198          let X#2 = (_|_){
   199            // [structural cycle] letCycleOK.t2.a.X: structural cycle
   200          }
   201          c: (int){ 1 }
   202        }
   203      }
   204    }
   205    letCycleFail: (_|_){
   206      // [structural cycle]
   207      t1: (_|_){
   208        // [structural cycle]
   209        a: (_|_){
   210          // [structural cycle]
   211          b: (int){ 1 }
   212          let X#3 = (_|_){
   213            // [structural cycle] letCycleFail.t1.a.X: structural cycle
   214          }
   215          c: (_|_){
   216            // [structural cycle] letCycleFail.t1.a.c: structural cycle
   217          }
   218        }
   219      }
   220      t2: (struct){
   221        a: (struct){
   222          let X#4 = (_|_){
   223            // [structural cycle] letCycleFail.t2.a.X: structural cycle:
   224            //     ./in.cue:43:6
   225          }
   226          x: (struct){
   227            y: (string){ "" }
   228          }
   229        }
   230      }
   231    }
   232    listCycleOK: (struct){
   233      a: (_){ _ }
   234      b: (_){ _ }
   235      c: (_){ _ }
   236    }
   237    disjunctionCycle: (_|_){
   238      // [eval]
   239      a: (_|_){
   240        // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   241        //     ./in.cue:56:5
   242        //     ./in.cue:56:9
   243      }
   244      b: (_|_){
   245        // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   246        //     ./in.cue:56:5
   247        //     ./in.cue:56:9
   248      }
   249      c: (_|_){
   250        // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   251        //     ./in.cue:56:5
   252        //     ./in.cue:56:9
   253      }
   254    }
   255    forCycle: (_|_){
   256      // [structural cycle]
   257      #A: (_|_){
   258        // [structural cycle]
   259        a: (_|_){
   260          // [structural cycle] b: structural cycle:
   261          //     ./in.cue:62:6
   262        }
   263      }
   264      #B: (_|_){
   265        // [structural cycle] b: structural cycle:
   266        //     ./in.cue:62:6
   267      }
   268    }
   269    letCycleWithAnd: (struct){
   270      a: (struct){
   271        d: (struct){
   272        }
   273      }
   274      b: (struct){
   275      }
   276      c: ~(letCycleWithAnd.a)
   277    }
   278    closeCycle: (_|_){
   279      // [structural cycle]
   280      a: ~(closeCycle.b)
   281      b: (_|_){
   282        // [structural cycle]
   283        d: (_|_){
   284          // [structural cycle] closeCycle.c: structural cycle
   285        }
   286      }
   287      c: (_|_){
   288        // [structural cycle] closeCycle.c: structural cycle
   289      }
   290    }
   291    structCycle: (_|_){
   292      // [structural cycle]
   293      a: ~(structCycle.b)
   294      b: (_|_){
   295        // [structural cycle]
   296        d: (_|_){
   297          // [structural cycle] structCycle.c: structural cycle
   298        }
   299      }
   300      c: (_|_){
   301        // [structural cycle] structCycle.c: structural cycle
   302      }
   303    }
   304    embedCycle: (struct){
   305      a: (#struct){
   306      }
   307      b: (#struct){
   308      }
   309      c: (#struct){
   310      }
   311    }
   312    listAddCycle: (_|_){
   313      // [structural cycle]
   314      a: (_|_){
   315        // [structural cycle] listAddCycle.c: structural cycle:
   316        //     ./in.cue:91:5
   317      }
   318      b: (_|_){
   319        // [structural cycle] listAddCycle.c: structural cycle:
   320        //     ./in.cue:91:5
   321      }
   322      c: (_|_){
   323        // [structural cycle] listAddCycle.c: structural cycle:
   324        //     ./in.cue:91:5
   325      }
   326    }
   327    listMulCycle: (_|_){
   328      // [structural cycle]
   329      a: (_|_){
   330        // [structural cycle] listMulCycle.c: structural cycle:
   331        //     ./in.cue:97:5
   332      }
   333      b: (_|_){
   334        // [structural cycle] listMulCycle.c: structural cycle:
   335        //     ./in.cue:97:5
   336      }
   337      c: (_|_){
   338        // [structural cycle] listMulCycle.c: structural cycle:
   339        //     ./in.cue:97:5
   340      }
   341    }
   342    closeFail: (_|_){
   343      // [eval]
   344      #T: (#struct){
   345        a: (string){ string }
   346      }
   347      x: (_|_){
   348        // [eval]
   349        b: (_|_){
   350          // [eval] closeFail.x.b: field not allowed:
   351          //     ./in.cue:104:6
   352          //     ./in.cue:107:5
   353        }
   354        a: (string){ string }
   355      }
   356    }
   357    printCycle: (_|_){
   358      // [structural cycle]
   359      a: (_|_){
   360        // [structural cycle]
   361        X: (_|_){
   362          // [structural cycle] printCycle.a.X: structural cycle
   363        }
   364      }
   365    }
   366  }
   367  -- diff/-out/evalalpha<==>+out/eval --
   368  diff old new
   369  --- old
   370  +++ new
   371  @@ -1,33 +1,20 @@
   372   Errors:
   373  -closeCycle.a: structural cycle
   374  -closeCycle.b.d: structural cycle
   375  +closeCycle.c: structural cycle
   376   closeFail.x.b: field not allowed:
   377       ./in.cue:104:6
   378  -    ./in.cue:105:12
   379  -    ./in.cue:106:6
   380       ./in.cue:107:5
   381   letCycleFail.t1.a.c: structural cycle
   382  -structCycle.a: structural cycle
   383  -structCycle.b.d: structural cycle
   384  -disjunctionCycle.a: cannot use 1 (type int) as type list:
   385  -    ./in.cue:56:5
   386  -    ./in.cue:56:9
   387  +printCycle.a.X: structural cycle
   388  +structCycle.c: structural cycle
   389   disjunctionCycle.b: cannot use 1 (type int) as type list:
   390       ./in.cue:56:5
   391       ./in.cue:56:9
   392  -disjunctionCycle.c: cannot use 1 (type int) as type list:
   393  -    ./in.cue:56:5
   394  -    ./in.cue:56:9
   395   b: structural cycle:
   396       ./in.cue:62:6
   397  -closeCycle.c: structural cycle:
   398  -    ./in.cue:73:15
   399  -structCycle.c: structural cycle:
   400  -    ./in.cue:79:14
   401  -embedCycle: structural cycle:
   402  -    ./in.cue:85:11
   403  -printCycle.a.X.X: structural cycle:
   404  -    ./in.cue:113:6
   405  +listAddCycle.c: structural cycle:
   406  +    ./in.cue:91:5
   407  +listMulCycle.c: structural cycle:
   408  +    ./in.cue:97:5
   409   
   410   Result:
   411   (_|_){
   412  @@ -65,14 +52,9 @@
   413       }
   414       t2: (struct){
   415         a: (struct){
   416  -        let X#4 = (struct){
   417  -          let X#4 = (_|_){
   418  -            // [structural cycle] letCycleFail.t2.a.X.X: structural cycle:
   419  -            //     ./in.cue:43:6
   420  -          }
   421  -          x: (struct){
   422  -            y: (string){ "" }
   423  -          }
   424  +        let X#4 = (_|_){
   425  +          // [structural cycle] letCycleFail.t2.a.X: structural cycle:
   426  +          //     ./in.cue:43:6
   427           }
   428           x: (struct){
   429             y: (string){ "" }
   430  @@ -88,17 +70,17 @@
   431     disjunctionCycle: (_|_){
   432       // [eval]
   433       a: (_|_){
   434  -      // [eval] disjunctionCycle.a: cannot use 1 (type int) as type list:
   435  -      //     ./in.cue:56:5
   436  -      //     ./in.cue:56:9
   437  -    }
   438  -    b: (_|_){
   439  -      // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   440  -      //     ./in.cue:56:5
   441  -      //     ./in.cue:56:9
   442  -    }
   443  -    c: (_|_){
   444  -      // [eval] disjunctionCycle.c: cannot use 1 (type int) as type list:
   445  +      // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   446  +      //     ./in.cue:56:5
   447  +      //     ./in.cue:56:9
   448  +    }
   449  +    b: (_|_){
   450  +      // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   451  +      //     ./in.cue:56:5
   452  +      //     ./in.cue:56:9
   453  +    }
   454  +    c: (_|_){
   455  +      // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   456         //     ./in.cue:56:5
   457         //     ./in.cue:56:9
   458       }
   459  @@ -124,80 +106,70 @@
   460       }
   461       b: (struct){
   462       }
   463  -    c: (struct){
   464  -      d: (struct){
   465  -      }
   466  -    }
   467  +    c: ~(letCycleWithAnd.a)
   468     }
   469     closeCycle: (_|_){
   470       // [structural cycle]
   471  -    a: (_|_){
   472  -      // [structural cycle] closeCycle.a: structural cycle
   473  -    }
   474  -    b: (_|_){
   475  -      // [structural cycle]
   476  -      d: (_|_){
   477  -        // [structural cycle] closeCycle.b.d: structural cycle
   478  -      }
   479  -    }
   480  -    c: (_|_){
   481  -      // [structural cycle] closeCycle.c: structural cycle:
   482  -      //     ./in.cue:73:15
   483  +    a: ~(closeCycle.b)
   484  +    b: (_|_){
   485  +      // [structural cycle]
   486  +      d: (_|_){
   487  +        // [structural cycle] closeCycle.c: structural cycle
   488  +      }
   489  +    }
   490  +    c: (_|_){
   491  +      // [structural cycle] closeCycle.c: structural cycle
   492       }
   493     }
   494     structCycle: (_|_){
   495       // [structural cycle]
   496  -    a: (_|_){
   497  -      // [structural cycle] structCycle.a: structural cycle
   498  -    }
   499  -    b: (_|_){
   500  -      // [structural cycle]
   501  -      d: (_|_){
   502  -        // [structural cycle] structCycle.b.d: structural cycle
   503  -      }
   504  -    }
   505  -    c: (_|_){
   506  -      // [structural cycle] structCycle.c: structural cycle:
   507  -      //     ./in.cue:79:14
   508  -    }
   509  -  }
   510  -  embedCycle: (_|_){
   511  -    // [structural cycle]
   512  -    a: (_|_){
   513  -      // [structural cycle] embedCycle: structural cycle:
   514  -      //     ./in.cue:85:11
   515  -    }
   516  -    b: (_|_){
   517  -      // [structural cycle] embedCycle: structural cycle:
   518  -      //     ./in.cue:85:11
   519  -    }
   520  -    c: (_|_){
   521  -      // [structural cycle] embedCycle: structural cycle:
   522  -      //     ./in.cue:85:11
   523  +    a: ~(structCycle.b)
   524  +    b: (_|_){
   525  +      // [structural cycle]
   526  +      d: (_|_){
   527  +        // [structural cycle] structCycle.c: structural cycle
   528  +      }
   529  +    }
   530  +    c: (_|_){
   531  +      // [structural cycle] structCycle.c: structural cycle
   532  +    }
   533  +  }
   534  +  embedCycle: (struct){
   535  +    a: (#struct){
   536  +    }
   537  +    b: (#struct){
   538  +    }
   539  +    c: (#struct){
   540       }
   541     }
   542     listAddCycle: (_|_){
   543       // [structural cycle]
   544       a: (_|_){
   545  -      // [structural cycle]
   546  -    }
   547  -    b: (_|_){
   548  -      // [structural cycle]
   549  -    }
   550  -    c: (_|_){
   551  -      // [structural cycle]
   552  +      // [structural cycle] listAddCycle.c: structural cycle:
   553  +      //     ./in.cue:91:5
   554  +    }
   555  +    b: (_|_){
   556  +      // [structural cycle] listAddCycle.c: structural cycle:
   557  +      //     ./in.cue:91:5
   558  +    }
   559  +    c: (_|_){
   560  +      // [structural cycle] listAddCycle.c: structural cycle:
   561  +      //     ./in.cue:91:5
   562       }
   563     }
   564     listMulCycle: (_|_){
   565       // [structural cycle]
   566       a: (_|_){
   567  -      // [structural cycle]
   568  -    }
   569  -    b: (_|_){
   570  -      // [structural cycle]
   571  -    }
   572  -    c: (_|_){
   573  -      // [structural cycle]
   574  +      // [structural cycle] listMulCycle.c: structural cycle:
   575  +      //     ./in.cue:97:5
   576  +    }
   577  +    b: (_|_){
   578  +      // [structural cycle] listMulCycle.c: structural cycle:
   579  +      //     ./in.cue:97:5
   580  +    }
   581  +    c: (_|_){
   582  +      // [structural cycle] listMulCycle.c: structural cycle:
   583  +      //     ./in.cue:97:5
   584       }
   585     }
   586     closeFail: (_|_){
   587  @@ -207,21 +179,21 @@
   588       }
   589       x: (_|_){
   590         // [eval]
   591  -      a: (string){ string }
   592         b: (_|_){
   593           // [eval] closeFail.x.b: field not allowed:
   594           //     ./in.cue:104:6
   595  -        //     ./in.cue:105:12
   596  -        //     ./in.cue:106:6
   597           //     ./in.cue:107:5
   598         }
   599  +      a: (string){ string }
   600       }
   601     }
   602     printCycle: (_|_){
   603       // [structural cycle]
   604       a: (_|_){
   605  -      // [structural cycle] printCycle.a.X.X: structural cycle:
   606  -      //     ./in.cue:113:6
   607  +      // [structural cycle]
   608  +      X: (_|_){
   609  +        // [structural cycle] printCycle.a.X: structural cycle
   610  +      }
   611       }
   612     }
   613   }
   614  -- diff/explanation --
   615  embedCycle: technically not a structural cycle, so V3 result
   616  is okay or even an improvement.
   617  -- out/eval --
   618  Errors:
   619  closeCycle.a: structural cycle
   620  closeCycle.b.d: structural cycle
   621  closeFail.x.b: field not allowed:
   622      ./in.cue:104:6
   623      ./in.cue:105:12
   624      ./in.cue:106:6
   625      ./in.cue:107:5
   626  letCycleFail.t1.a.c: structural cycle
   627  structCycle.a: structural cycle
   628  structCycle.b.d: structural cycle
   629  disjunctionCycle.a: cannot use 1 (type int) as type list:
   630      ./in.cue:56:5
   631      ./in.cue:56:9
   632  disjunctionCycle.b: cannot use 1 (type int) as type list:
   633      ./in.cue:56:5
   634      ./in.cue:56:9
   635  disjunctionCycle.c: cannot use 1 (type int) as type list:
   636      ./in.cue:56:5
   637      ./in.cue:56:9
   638  b: structural cycle:
   639      ./in.cue:62:6
   640  closeCycle.c: structural cycle:
   641      ./in.cue:73:15
   642  structCycle.c: structural cycle:
   643      ./in.cue:79:14
   644  embedCycle: structural cycle:
   645      ./in.cue:85:11
   646  printCycle.a.X.X: structural cycle:
   647      ./in.cue:113:6
   648  
   649  Result:
   650  (_|_){
   651    // [eval]
   652    letCycleOK: (struct){
   653      t1: (struct){
   654        b: (_){ _ }
   655        let X#1 = (_){ _ }
   656        c: (_){ _ }
   657      }
   658      t2: (struct){
   659        a: (struct){
   660          b: (int){ 1 }
   661          let X#2 = (_|_){
   662            // [structural cycle] letCycleOK.t2.a.X: structural cycle
   663          }
   664          c: (int){ 1 }
   665        }
   666      }
   667    }
   668    letCycleFail: (_|_){
   669      // [structural cycle]
   670      t1: (_|_){
   671        // [structural cycle]
   672        a: (_|_){
   673          // [structural cycle]
   674          b: (int){ 1 }
   675          let X#3 = (_|_){
   676            // [structural cycle] letCycleFail.t1.a.X: structural cycle
   677          }
   678          c: (_|_){
   679            // [structural cycle] letCycleFail.t1.a.c: structural cycle
   680          }
   681        }
   682      }
   683      t2: (struct){
   684        a: (struct){
   685          let X#4 = (struct){
   686            let X#4 = (_|_){
   687              // [structural cycle] letCycleFail.t2.a.X.X: structural cycle:
   688              //     ./in.cue:43:6
   689            }
   690            x: (struct){
   691              y: (string){ "" }
   692            }
   693          }
   694          x: (struct){
   695            y: (string){ "" }
   696          }
   697        }
   698      }
   699    }
   700    listCycleOK: (struct){
   701      a: (_){ _ }
   702      b: (_){ _ }
   703      c: (_){ _ }
   704    }
   705    disjunctionCycle: (_|_){
   706      // [eval]
   707      a: (_|_){
   708        // [eval] disjunctionCycle.a: cannot use 1 (type int) as type list:
   709        //     ./in.cue:56:5
   710        //     ./in.cue:56:9
   711      }
   712      b: (_|_){
   713        // [eval] disjunctionCycle.b: cannot use 1 (type int) as type list:
   714        //     ./in.cue:56:5
   715        //     ./in.cue:56:9
   716      }
   717      c: (_|_){
   718        // [eval] disjunctionCycle.c: cannot use 1 (type int) as type list:
   719        //     ./in.cue:56:5
   720        //     ./in.cue:56:9
   721      }
   722    }
   723    forCycle: (_|_){
   724      // [structural cycle]
   725      #A: (_|_){
   726        // [structural cycle]
   727        a: (_|_){
   728          // [structural cycle] b: structural cycle:
   729          //     ./in.cue:62:6
   730        }
   731      }
   732      #B: (_|_){
   733        // [structural cycle] b: structural cycle:
   734        //     ./in.cue:62:6
   735      }
   736    }
   737    letCycleWithAnd: (struct){
   738      a: (struct){
   739        d: (struct){
   740        }
   741      }
   742      b: (struct){
   743      }
   744      c: (struct){
   745        d: (struct){
   746        }
   747      }
   748    }
   749    closeCycle: (_|_){
   750      // [structural cycle]
   751      a: (_|_){
   752        // [structural cycle] closeCycle.a: structural cycle
   753      }
   754      b: (_|_){
   755        // [structural cycle]
   756        d: (_|_){
   757          // [structural cycle] closeCycle.b.d: structural cycle
   758        }
   759      }
   760      c: (_|_){
   761        // [structural cycle] closeCycle.c: structural cycle:
   762        //     ./in.cue:73:15
   763      }
   764    }
   765    structCycle: (_|_){
   766      // [structural cycle]
   767      a: (_|_){
   768        // [structural cycle] structCycle.a: structural cycle
   769      }
   770      b: (_|_){
   771        // [structural cycle]
   772        d: (_|_){
   773          // [structural cycle] structCycle.b.d: structural cycle
   774        }
   775      }
   776      c: (_|_){
   777        // [structural cycle] structCycle.c: structural cycle:
   778        //     ./in.cue:79:14
   779      }
   780    }
   781    embedCycle: (_|_){
   782      // [structural cycle]
   783      a: (_|_){
   784        // [structural cycle] embedCycle: structural cycle:
   785        //     ./in.cue:85:11
   786      }
   787      b: (_|_){
   788        // [structural cycle] embedCycle: structural cycle:
   789        //     ./in.cue:85:11
   790      }
   791      c: (_|_){
   792        // [structural cycle] embedCycle: structural cycle:
   793        //     ./in.cue:85:11
   794      }
   795    }
   796    listAddCycle: (_|_){
   797      // [structural cycle]
   798      a: (_|_){
   799        // [structural cycle]
   800      }
   801      b: (_|_){
   802        // [structural cycle]
   803      }
   804      c: (_|_){
   805        // [structural cycle]
   806      }
   807    }
   808    listMulCycle: (_|_){
   809      // [structural cycle]
   810      a: (_|_){
   811        // [structural cycle]
   812      }
   813      b: (_|_){
   814        // [structural cycle]
   815      }
   816      c: (_|_){
   817        // [structural cycle]
   818      }
   819    }
   820    closeFail: (_|_){
   821      // [eval]
   822      #T: (#struct){
   823        a: (string){ string }
   824      }
   825      x: (_|_){
   826        // [eval]
   827        a: (string){ string }
   828        b: (_|_){
   829          // [eval] closeFail.x.b: field not allowed:
   830          //     ./in.cue:104:6
   831          //     ./in.cue:105:12
   832          //     ./in.cue:106:6
   833          //     ./in.cue:107:5
   834        }
   835      }
   836    }
   837    printCycle: (_|_){
   838      // [structural cycle]
   839      a: (_|_){
   840        // [structural cycle] printCycle.a.X.X: structural cycle:
   841        //     ./in.cue:113:6
   842      }
   843    }
   844  }
   845  -- out/compile --
   846  --- in.cue
   847  {
   848    letCycleOK: {
   849      t1: {
   850        b: 〈0;c〉
   851        let X#1 = 〈0;b〉
   852        c: 〈0;let X#1〉
   853      }
   854    }
   855    letCycleOK: {
   856      t2: {
   857        a: {
   858          b: 1
   859          let X#2 = 〈1;a〉
   860          c: 〈0;let X#2〉.b
   861        }
   862      }
   863    }
   864    letCycleFail: {
   865      t1: {
   866        a: {
   867          b: 1
   868          let X#3 = 〈1;a〉
   869          c: 〈0;let X#3〉
   870        }
   871      }
   872    }
   873    letCycleFail: {
   874      t2: {
   875        a: {
   876          let X#4 = 〈1;a〉
   877          if (〈0;let X#4〉 == _|_(explicit error (_|_ literal) in source)) {}
   878          x: {
   879            y: ""
   880          }
   881        }
   882      }
   883    }
   884    listCycleOK: {
   885      a: 〈0;b〉
   886      b: and([
   887        〈1;c〉,
   888      ])
   889      c: 〈0;a〉
   890    }
   891    disjunctionCycle: {
   892      a: 〈0;b〉
   893      b: and((1|〈0;c〉))
   894      c: 〈0;a〉
   895    }
   896    forCycle: {
   897      #A: {
   898        a: 〈1;#B〉
   899      }
   900      #B: or([
   901        for _, x in 〈1;#A〉 {
   902          b: 〈1;x〉
   903        },
   904      ])
   905    }
   906    letCycleWithAnd: {
   907      a: {
   908        d: 〈1;b〉
   909      }
   910      b: and([
   911        for _, x in 〈1;a〉 let y = 〈0;x〉 {
   912          〈1;y〉
   913        },
   914      ])
   915      c: 〈0;a〉
   916    }
   917    closeCycle: {
   918      a: 〈0;b〉
   919      b: close({
   920        d: 〈1;c〉
   921      })
   922      c: 〈0;a〉
   923    }
   924    structCycle: {
   925      a: 〈0;b〉
   926      b: and([
   927        {
   928          d: 〈2;c〉
   929        },
   930      ])
   931      c: 〈0;a〉
   932    }
   933    embedCycle: {
   934      a: 〈0;b〉
   935      b: close({
   936        〈1;c〉
   937      })
   938      c: 〈0;a〉
   939    }
   940    listAddCycle: {
   941      a: 〈0;b〉
   942      b: 〈import;list〉.Concat([
   943        [
   944          〈2;c〉,
   945        ],
   946        [
   947          〈2;c〉,
   948        ],
   949      ])
   950      c: 〈0;a〉
   951    }
   952    listMulCycle: {
   953      a: 〈0;b〉
   954      b: 〈import;list〉.Repeat([
   955        {
   956          a: {
   957            b: 〈3;c〉
   958          }
   959        },
   960      ], 3)
   961      c: 〈0;a〉
   962    }
   963    closeFail: {
   964      #T: {
   965        [_]: _
   966      }
   967      #T: close({
   968        a: string
   969      })
   970      x: 〈0;#T〉
   971      x: {
   972        b: "foo"
   973      }
   974    }
   975    printCycle: {
   976      a: {
   977        X: 〈1;a〉
   978        if 〈0;X〉 {}
   979      }
   980    }
   981  }