cuelang.org/go@v0.10.1/cue/testdata/cycle/compbottom2.txtar (about)

     1  -- in.cue --
     2  self: {
     3  	// This is an incomplete error, as it may succeed when the user
     4  	// explicitly specifies a value for fail.a.b.
     5  	fail: {
     6  		a: {
     7  			if a.b == _|_ {
     8  				b: 1
     9  			}
    10  		}
    11  	}
    12  
    13  	// This is an incomplete error, as it may succeed when the user
    14  	// explicitly specifies a value for a.b.
    15  	isConcreteFail: t1:{
    16  		a: {
    17  			if a.b == _|_ {
    18  				b: 1
    19  			}
    20  			b: int
    21  		}
    22  	}
    23  
    24  	isConcreteFail: t2:{
    25  		a: {
    26  			if a.b == _|_ {
    27  				b: 1
    28  			}
    29  			b?: int
    30  		}
    31  	}
    32  
    33  	// This is an incomplete error, as it may succeed when the user
    34  	// explicitly specifies a value for a.b.
    35  	// TODO: new builtin semantics.
    36  	//     if isconcrete(a.b)  -->> cyclic error evaluating isconcrete.
    37  	//     if isdefined(a.b)   -->> evaluate to true as a.b is int, result is 1
    38  	//     if !isdefined(a.b)  -->> evaluate to false, a.b remains int
    39  	isNotConcrete: t1: {
    40  		a: {
    41  			if a.b != _|_ {
    42  				b: 1
    43  			}
    44  			b: int
    45  		}
    46  	}
    47  	isNotConcrete: t2: {
    48  		a: {
    49  			if a.b != _|_ {
    50  				b: 1
    51  			}
    52  			b?: int
    53  		}
    54  	}
    55  
    56  }
    57  
    58  -- mutual.cue --
    59  mutual: {
    60  	noConflicts: {
    61  		a: {if b.foo == _|_ {new: ""}}
    62  		b: {if a.bar == _|_ {new: ""}}
    63  	}
    64  
    65  	mutualCycleFail: {
    66  		b: {if a.bar == _|_ {foo: ""}}
    67  		a: {if b.foo == _|_ {bar: ""}}
    68  	}
    69  
    70  	brokenCycleSuccess: {
    71  		a: { if b.foo == _|_ { foo: "" } }
    72  		b: { if a.bar == _|_ { bar: "" } }
    73  		a: bar: ""
    74  	}
    75  
    76  	allowOneDirectionalDependency: {
    77  		p1: {
    78  			a: { if b.foo == _|_ { bar: "" } } // added
    79  			b: { if a.bar == _|_ { new: "" } } // not added
    80  		}
    81  		p2: {
    82  			a: { if b.foo == _|_ { new: "" } }
    83  			b: { if a.bar == _|_ { foo: "" } }
    84  		}
    85  	}
    86  
    87  	oneDirectionalBrokenConflictSuccess: p1: {
    88  		b: foo: ""
    89  		a: { if b.foo == _|_ { bar: "" } }
    90  		b: { if a.bar == _|_ { new: "" } }
    91  	}
    92  	oneDirectionalBrokenConflictSuccess: p2: {
    93  		a: { if b.foo == _|_ { bar: "" } }
    94  		b: foo: ""
    95  		b: { if a.bar == _|_ { new: "" } }
    96  	}
    97  	oneDirectionalBrokenConflictSuccess: p3: {
    98  		a: { if b.foo == _|_ { bar: "" } }
    99  		b: { if a.bar == _|_ { new: "" } }
   100  		b: foo: ""
   101  	}
   102  	oneDirectionalBrokenConflictSuccess: p4: {
   103  		b: foo: ""
   104  		b: { if a.bar == _|_ { new: "" } }
   105  		a: { if b.foo == _|_ { bar: "" } }
   106  	}
   107  	oneDirectionalBrokenConflictSuccess: p5: {
   108  		b: { if a.bar == _|_ { new: "" } }
   109  		b: foo: ""
   110  		a: { if b.foo == _|_ { bar: "" } }
   111  	}
   112  	oneDirectionalBrokenConflictSuccess: p6: {
   113  		b: { if a.bar == _|_ { new: "" } }
   114  		a: { if b.foo == _|_ { bar: "" } }
   115  		b: foo: ""
   116  	}
   117  }
   118  
   119  -- mutualsamestruct.cue --
   120  sameStruct: {
   121  	chainSuccess: a: {
   122  		raises?: {}
   123  		if raises == _|_ {
   124  		ret: a: 1
   125  		}
   126  		ret?: {}
   127  		if ret != _|_ {
   128  		foo: a: 1
   129  		}
   130  	}
   131  
   132  	chainSuccess: b: {
   133  		if ret != _|_ {
   134  		foo: a: 1
   135  		}
   136  		raises?: {}
   137  		if raises == _|_ {
   138  		ret: a: 1
   139  		}
   140  		ret?: {}
   141  	}
   142  
   143  	cycleFail: t1: p1: {
   144  		raises?: {}
   145  		if raises == _|_ {
   146  			ret: a: 1
   147  		}
   148  		ret?: {}
   149  		if ret != _|_ {
   150  			raises: a: 1
   151  		}
   152  	}
   153  
   154  	cycleFail: t1: p2: {
   155  		ret?: {}
   156  		if ret != _|_ {
   157  			raises: a: 1
   158  		}
   159  		raises?: {}
   160  		if raises == _|_ {
   161  			ret: a: 1
   162  		}
   163  	}
   164  
   165  	// This test should fail with a cycle error. Even though raises and ret are
   166  	// both known to be defined, comparison against bottom requires that the
   167  	// structs be recursively checked for errors. We disallow that here, because
   168  	// the structs mutually depend on each other.
   169  	// TODO: consider allowing a specific postCheck for determining if an arc
   170  	// is erroneous.
   171  	cycleFail: t2: p1: {
   172  		raises: {}
   173  		if raises == _|_ {
   174  			ret: a: 1
   175  		}
   176  		ret: {}
   177  		if ret != _|_ {
   178  			raises: a: 1
   179  		}
   180  	}
   181  
   182  	// Same as above test, but different order. It may be that the specific
   183  	// fields that are added are different for the two cases. This is fine as
   184  	// long as the parent fails, as that error is ultimately what represents
   185  	// the value as a whole.
   186  	cycleFail: t2: p2: {
   187  		ret: {}
   188  		if ret != _|_ {
   189  			raises: a: 1
   190  		}
   191  		raises: {}
   192  		if raises == _|_ {
   193  			ret: a: 1
   194  		}
   195  	}
   196  
   197  	// This test should fail similarly to the above tests. The fields ret and
   198  	// raises are not concrete, but may still become a struct and thus need
   199  	// to be recursively checked.
   200  	cycleFail: t3: p1: {
   201  		raises: _
   202  		if raises == _|_ {
   203  			ret: a: 1
   204  		}
   205  		ret: _
   206  		if ret != _|_ {
   207  			raises: a: 1
   208  		}
   209  	}
   210  
   211  	cycleFail: t3: p2: {
   212  		ret: _
   213  		if ret != _|_ {
   214  			raises: a: 1
   215  		}
   216  		raises: _
   217  		if raises == _|_ {
   218  			ret: a: 1
   219  		}
   220  	}
   221  
   222  	defCloseSuccess: {
   223  		#Example: {
   224  			raises?: {
   225  				runtime?: string
   226  			}
   227  
   228  			if raises == _|_ {
   229  				ret?: _
   230  			}
   231  		}
   232  
   233  		expr: #Example & {
   234  			ret: 2
   235  		}
   236  	}
   237  }
   238  
   239  -- nestedchain.cue --
   240  // Issue
   241  nestedChain: {
   242  	cycleFail: {
   243  		if #E.x != _|_ {
   244  			#E: y: true
   245  		}
   246  		if #E.y == _|_ {
   247  			#E: x: true
   248  		}
   249  		#E: [_]: bool
   250  	}
   251  
   252  	brokenCycleSuccess: {
   253  		if #E.x != _|_ {
   254  			#E: y: true
   255  		}
   256  		if #E.y == _|_ {
   257  			#E: x: true
   258  		}
   259  		#E: [_]: bool
   260  		#E: x:   true
   261  	}
   262  
   263  	doubleAddfail: {
   264  		if #E.x == _|_ {
   265  			#E: y: true
   266  		}
   267  		if #E.y == _|_ {
   268  			#E: x: true
   269  		}
   270  		#E: [_]: bool
   271  	}
   272  
   273  	trippleSuccess: {
   274  		if #E.x != _|_ {
   275  			#E: y: true
   276  		}
   277  		if #E.y != _|_ {
   278  			z: true
   279  		}
   280  		#E: x: true
   281  	}
   282  }
   283  -- out/eval/stats --
   284  Leaks:  1
   285  Freed:  158
   286  Reused: 149
   287  Allocs: 10
   288  Retain: 73
   289  
   290  Unifications: 159
   291  Conjuncts:    169
   292  Disjuncts:    210
   293  -- out/evalalpha --
   294  (struct){
   295    self: (struct){
   296      fail: (struct){
   297        a: (_|_){
   298          // [incomplete] self.fail.a.b: cyclic reference to field b:
   299          //     ./in.cue:6:4
   300        }
   301      }
   302      isConcreteFail: (struct){
   303        t1: (struct){
   304          a: (struct){
   305            b: (int){ 1 }
   306          }
   307        }
   308        t2: (struct){
   309          a: (struct){
   310            b?: (_|_){
   311              // [incomplete] self.isConcreteFail.t2.a.b: cyclic reference to field b:
   312              //     ./in.cue:26:8
   313            }
   314          }
   315        }
   316      }
   317      isNotConcrete: (struct){
   318        t1: (struct){
   319          a: (struct){
   320            b: (int){ int }
   321          }
   322        }
   323        t2: (struct){
   324          a: (struct){
   325            b?: (int){ int }
   326          }
   327        }
   328      }
   329    }
   330    mutual: (struct){
   331      noConflicts: (struct){
   332        a: (struct){
   333          new: (string){ "" }
   334        }
   335        b: (struct){
   336          new: (string){ "" }
   337        }
   338      }
   339      mutualCycleFail: (struct){
   340        b: (_|_){
   341          // [incomplete] mutual.mutualCycleFail.b.foo: cyclic reference to field foo:
   342          //     ./mutual.cue:8:7
   343        }
   344        a: (_|_){
   345          // [incomplete] mutual.mutualCycleFail.a.bar: cyclic reference to field bar:
   346          //     ./mutual.cue:9:7
   347        }
   348      }
   349      brokenCycleSuccess: (struct){
   350        a: (struct){
   351          foo: (string){ "" }
   352          bar: (string){ "" }
   353        }
   354        b: (struct){
   355        }
   356      }
   357      allowOneDirectionalDependency: (struct){
   358        p1: (struct){
   359          a: (struct){
   360            bar: (string){ "" }
   361          }
   362          b: (struct){
   363          }
   364        }
   365        p2: (struct){
   366          a: (struct){
   367          }
   368          b: (struct){
   369            foo: (string){ "" }
   370          }
   371        }
   372      }
   373      oneDirectionalBrokenConflictSuccess: (struct){
   374        p1: (struct){
   375          b: (struct){
   376            foo: (string){ "" }
   377            new: (string){ "" }
   378          }
   379          a: (struct){
   380          }
   381        }
   382        p2: (struct){
   383          a: (struct){
   384          }
   385          b: (struct){
   386            foo: (string){ "" }
   387            new: (string){ "" }
   388          }
   389        }
   390        p3: (struct){
   391          a: (struct){
   392          }
   393          b: (struct){
   394            new: (string){ "" }
   395            foo: (string){ "" }
   396          }
   397        }
   398        p4: (struct){
   399          b: (struct){
   400            foo: (string){ "" }
   401            new: (string){ "" }
   402          }
   403          a: (struct){
   404          }
   405        }
   406        p5: (struct){
   407          b: (struct){
   408            new: (string){ "" }
   409            foo: (string){ "" }
   410          }
   411          a: (struct){
   412          }
   413        }
   414        p6: (struct){
   415          b: (struct){
   416            new: (string){ "" }
   417            foo: (string){ "" }
   418          }
   419          a: (struct){
   420          }
   421        }
   422      }
   423    }
   424    sameStruct: (struct){
   425      chainSuccess: (struct){
   426        a: (struct){
   427          raises?: (struct){
   428          }
   429          ret: (struct){
   430            a: (int){ 1 }
   431          }
   432          foo: (struct){
   433            a: (int){ 1 }
   434          }
   435        }
   436        b: (struct){
   437          foo: (struct){
   438            a: (int){ 1 }
   439          }
   440          raises?: (struct){
   441          }
   442          ret: (struct){
   443            a: (int){ 1 }
   444          }
   445        }
   446      }
   447      cycleFail: (struct){
   448        t1: (struct){
   449          p1: (struct){
   450            raises?: (struct){
   451              a: (_|_){
   452                // [incomplete] sameStruct.cycleFail.t1.p1.raises.a: cyclic reference to field raises:
   453                //     ./mutualsamestruct.cue:31:15
   454              }
   455            }
   456            ret: (struct){
   457              a: (int){ 1 }
   458            }
   459          }
   460          p2: (struct){
   461            ret?: (struct){
   462              a: (_|_){
   463                // [incomplete] sameStruct.cycleFail.t1.p2.ret.a: cyclic reference to field ret:
   464                //     ./mutualsamestruct.cue:42:12
   465              }
   466            }
   467            raises?: (struct){
   468            }
   469          }
   470        }
   471        t2: (struct){
   472          p1: (struct){
   473            raises: (_|_){
   474              // [cycle] sameStruct.cycleFail.t2.p1.raises: mutual dependency
   475            }
   476            ret: (struct){
   477            }
   478          }
   479          p2: (struct){
   480            ret: (_|_){
   481              // [cycle] sameStruct.cycleFail.t2.p2.ret: mutual dependency
   482            }
   483            raises: (struct){
   484              a: (int){ 1 }
   485            }
   486          }
   487        }
   488        t3: (struct){
   489          p1: (struct){
   490            raises: (_|_){
   491              // [cycle] sameStruct.cycleFail.t3.p1.raises: mutual dependency
   492            }
   493            ret: (_){ _ }
   494          }
   495          p2: (struct){
   496            ret: (_|_){
   497              // [cycle] sameStruct.cycleFail.t3.p2.ret: mutual dependency
   498            }
   499            raises: (_){
   500              _
   501              a: (int){ 1 }
   502            }
   503          }
   504        }
   505      }
   506      defCloseSuccess: (struct){
   507        #Example: (#struct){
   508          raises?: (#struct){
   509            runtime?: (string){ string }
   510          }
   511          ret?: (_){ _ }
   512        }
   513        expr: (#struct){
   514          ret: (int){ 2 }
   515          raises?: (#struct){
   516            runtime?: (string){ string }
   517          }
   518        }
   519      }
   520    }
   521    nestedChain: (struct){
   522      cycleFail: (_|_){
   523        // [incomplete] nestedChain.cycleFail.#E.x: cyclic reference to field x:
   524        //     ./nestedchain.cue:7:3
   525        #E: (#struct){
   526        }
   527      }
   528      brokenCycleSuccess: (struct){
   529        #E: (#struct){
   530          y: (bool){ true }
   531          x: (bool){ true }
   532        }
   533      }
   534      doubleAddfail: (_|_){
   535        // [incomplete] nestedChain.doubleAddfail.#E.y: cyclic reference to field y:
   536        //     ./nestedchain.cue:25:3
   537        // nestedChain.doubleAddfail.#E.x: cyclic reference to field x:
   538        //     ./nestedchain.cue:28:3
   539        #E: (#struct){
   540        }
   541      }
   542      trippleSuccess: (struct){
   543        #E: (#struct){
   544          y: (bool){ true }
   545          x: (bool){ true }
   546        }
   547        z: (bool){ true }
   548      }
   549    }
   550  }
   551  -- diff/-out/evalalpha<==>+out/eval --
   552  diff old new
   553  --- old
   554  +++ new
   555  @@ -2,27 +2,29 @@
   556     self: (struct){
   557       fail: (struct){
   558         a: (_|_){
   559  -        // [cycle] self.fail.a: cycle with field a.b:
   560  -        //     ./in.cue:6:7
   561  +        // [incomplete] self.fail.a.b: cyclic reference to field b:
   562  +        //     ./in.cue:6:4
   563         }
   564       }
   565       isConcreteFail: (struct){
   566         t1: (struct){
   567  -        a: (_|_){
   568  -          // [cycle] cycle error
   569  -        }
   570  -      }
   571  -      t2: (struct){
   572  -        a: (_|_){
   573  -          // [cycle] self.isConcreteFail.t2.a: circular dependency in evaluation of conditionals: a.b changed after evaluation:
   574  -          //     ./in.cue:25:7
   575  +        a: (struct){
   576  +          b: (int){ 1 }
   577  +        }
   578  +      }
   579  +      t2: (struct){
   580  +        a: (struct){
   581  +          b?: (_|_){
   582  +            // [incomplete] self.isConcreteFail.t2.a.b: cyclic reference to field b:
   583  +            //     ./in.cue:26:8
   584  +          }
   585           }
   586         }
   587       }
   588       isNotConcrete: (struct){
   589         t1: (struct){
   590  -        a: (_|_){
   591  -          // [cycle] cycle error
   592  +        a: (struct){
   593  +          b: (int){ int }
   594           }
   595         }
   596         t2: (struct){
   597  @@ -43,12 +45,12 @@
   598       }
   599       mutualCycleFail: (struct){
   600         b: (_|_){
   601  -        // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
   602  -        //     ./mutual.cue:9:10
   603  -      }
   604  -      a: (_|_){
   605  -        // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
   606  -        //     ./mutual.cue:9:10
   607  +        // [incomplete] mutual.mutualCycleFail.b.foo: cyclic reference to field foo:
   608  +        //     ./mutual.cue:8:7
   609  +      }
   610  +      a: (_|_){
   611  +        // [incomplete] mutual.mutualCycleFail.a.bar: cyclic reference to field bar:
   612  +        //     ./mutual.cue:9:7
   613         }
   614       }
   615       brokenCycleSuccess: (struct){
   616  @@ -151,33 +153,60 @@
   617       }
   618       cycleFail: (struct){
   619         t1: (struct){
   620  -        p1: (_|_){
   621  -          // [cycle] sameStruct.cycleFail.t1.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
   622  -          //     ./mutualsamestruct.cue:26:6
   623  -        }
   624  -        p2: (_|_){
   625  -          // [cycle] sameStruct.cycleFail.t1.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
   626  -          //     ./mutualsamestruct.cue:37:6
   627  -        }
   628  -      }
   629  -      t2: (struct){
   630  -        p1: (_|_){
   631  -          // [cycle] sameStruct.cycleFail.t2.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
   632  -          //     ./mutualsamestruct.cue:54:6
   633  -        }
   634  -        p2: (_|_){
   635  -          // [cycle] sameStruct.cycleFail.t2.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
   636  -          //     ./mutualsamestruct.cue:69:6
   637  +        p1: (struct){
   638  +          raises?: (struct){
   639  +            a: (_|_){
   640  +              // [incomplete] sameStruct.cycleFail.t1.p1.raises.a: cyclic reference to field raises:
   641  +              //     ./mutualsamestruct.cue:31:15
   642  +            }
   643  +          }
   644  +          ret: (struct){
   645  +            a: (int){ 1 }
   646  +          }
   647  +        }
   648  +        p2: (struct){
   649  +          ret?: (struct){
   650  +            a: (_|_){
   651  +              // [incomplete] sameStruct.cycleFail.t1.p2.ret.a: cyclic reference to field ret:
   652  +              //     ./mutualsamestruct.cue:42:12
   653  +            }
   654  +          }
   655  +          raises?: (struct){
   656  +          }
   657  +        }
   658  +      }
   659  +      t2: (struct){
   660  +        p1: (struct){
   661  +          raises: (_|_){
   662  +            // [cycle] sameStruct.cycleFail.t2.p1.raises: mutual dependency
   663  +          }
   664  +          ret: (struct){
   665  +          }
   666  +        }
   667  +        p2: (struct){
   668  +          ret: (_|_){
   669  +            // [cycle] sameStruct.cycleFail.t2.p2.ret: mutual dependency
   670  +          }
   671  +          raises: (struct){
   672  +            a: (int){ 1 }
   673  +          }
   674           }
   675         }
   676         t3: (struct){
   677  -        p1: (_|_){
   678  -          // [cycle] sameStruct.cycleFail.t3.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
   679  -          //     ./mutualsamestruct.cue:83:6
   680  -        }
   681  -        p2: (_|_){
   682  -          // [cycle] sameStruct.cycleFail.t3.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
   683  -          //     ./mutualsamestruct.cue:94:6
   684  +        p1: (struct){
   685  +          raises: (_|_){
   686  +            // [cycle] sameStruct.cycleFail.t3.p1.raises: mutual dependency
   687  +          }
   688  +          ret: (_){ _ }
   689  +        }
   690  +        p2: (struct){
   691  +          ret: (_|_){
   692  +            // [cycle] sameStruct.cycleFail.t3.p2.ret: mutual dependency
   693  +          }
   694  +          raises: (_){
   695  +            _
   696  +            a: (int){ 1 }
   697  +          }
   698           }
   699         }
   700       }
   701  @@ -189,17 +218,19 @@
   702           ret?: (_){ _ }
   703         }
   704         expr: (#struct){
   705  -        raises?: (#struct){
   706  -          runtime?: (string){ string }
   707  -        }
   708           ret: (int){ 2 }
   709  +        raises?: (#struct){
   710  +          runtime?: (string){ string }
   711  +        }
   712         }
   713       }
   714     }
   715     nestedChain: (struct){
   716       cycleFail: (_|_){
   717  -      // [cycle] nestedChain.cycleFail: cycle with field #E.y:
   718  -      //     ./nestedchain.cue:7:6
   719  +      // [incomplete] nestedChain.cycleFail.#E.x: cyclic reference to field x:
   720  +      //     ./nestedchain.cue:7:3
   721  +      #E: (#struct){
   722  +      }
   723       }
   724       brokenCycleSuccess: (struct){
   725         #E: (#struct){
   726  @@ -208,8 +239,12 @@
   727         }
   728       }
   729       doubleAddfail: (_|_){
   730  -      // [cycle] nestedChain.doubleAddfail: cycle with field #E.y:
   731  -      //     ./nestedchain.cue:28:6
   732  +      // [incomplete] nestedChain.doubleAddfail.#E.y: cyclic reference to field y:
   733  +      //     ./nestedchain.cue:25:3
   734  +      // nestedChain.doubleAddfail.#E.x: cyclic reference to field x:
   735  +      //     ./nestedchain.cue:28:3
   736  +      #E: (#struct){
   737  +      }
   738       }
   739       trippleSuccess: (struct){
   740         #E: (#struct){
   741  -- diff/explanation --
   742  self.isConcreteFail: t1: int value is not an error.
   743  self.isNotConcrete: t1: int value is not an error.
   744  -- diff/todo/p3 --
   745  sameStruct.cycleFail: Harmonize and improve cycle errors
   746  cycleFail.t1.p1.raises?.a: error needs to be reported at parent node.
   747  -- out/eval --
   748  (struct){
   749    self: (struct){
   750      fail: (struct){
   751        a: (_|_){
   752          // [cycle] self.fail.a: cycle with field a.b:
   753          //     ./in.cue:6:7
   754        }
   755      }
   756      isConcreteFail: (struct){
   757        t1: (struct){
   758          a: (_|_){
   759            // [cycle] cycle error
   760          }
   761        }
   762        t2: (struct){
   763          a: (_|_){
   764            // [cycle] self.isConcreteFail.t2.a: circular dependency in evaluation of conditionals: a.b changed after evaluation:
   765            //     ./in.cue:25:7
   766          }
   767        }
   768      }
   769      isNotConcrete: (struct){
   770        t1: (struct){
   771          a: (_|_){
   772            // [cycle] cycle error
   773          }
   774        }
   775        t2: (struct){
   776          a: (struct){
   777            b?: (int){ int }
   778          }
   779        }
   780      }
   781    }
   782    mutual: (struct){
   783      noConflicts: (struct){
   784        a: (struct){
   785          new: (string){ "" }
   786        }
   787        b: (struct){
   788          new: (string){ "" }
   789        }
   790      }
   791      mutualCycleFail: (struct){
   792        b: (_|_){
   793          // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
   794          //     ./mutual.cue:9:10
   795        }
   796        a: (_|_){
   797          // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
   798          //     ./mutual.cue:9:10
   799        }
   800      }
   801      brokenCycleSuccess: (struct){
   802        a: (struct){
   803          foo: (string){ "" }
   804          bar: (string){ "" }
   805        }
   806        b: (struct){
   807        }
   808      }
   809      allowOneDirectionalDependency: (struct){
   810        p1: (struct){
   811          a: (struct){
   812            bar: (string){ "" }
   813          }
   814          b: (struct){
   815          }
   816        }
   817        p2: (struct){
   818          a: (struct){
   819          }
   820          b: (struct){
   821            foo: (string){ "" }
   822          }
   823        }
   824      }
   825      oneDirectionalBrokenConflictSuccess: (struct){
   826        p1: (struct){
   827          b: (struct){
   828            foo: (string){ "" }
   829            new: (string){ "" }
   830          }
   831          a: (struct){
   832          }
   833        }
   834        p2: (struct){
   835          a: (struct){
   836          }
   837          b: (struct){
   838            foo: (string){ "" }
   839            new: (string){ "" }
   840          }
   841        }
   842        p3: (struct){
   843          a: (struct){
   844          }
   845          b: (struct){
   846            new: (string){ "" }
   847            foo: (string){ "" }
   848          }
   849        }
   850        p4: (struct){
   851          b: (struct){
   852            foo: (string){ "" }
   853            new: (string){ "" }
   854          }
   855          a: (struct){
   856          }
   857        }
   858        p5: (struct){
   859          b: (struct){
   860            new: (string){ "" }
   861            foo: (string){ "" }
   862          }
   863          a: (struct){
   864          }
   865        }
   866        p6: (struct){
   867          b: (struct){
   868            new: (string){ "" }
   869            foo: (string){ "" }
   870          }
   871          a: (struct){
   872          }
   873        }
   874      }
   875    }
   876    sameStruct: (struct){
   877      chainSuccess: (struct){
   878        a: (struct){
   879          raises?: (struct){
   880          }
   881          ret: (struct){
   882            a: (int){ 1 }
   883          }
   884          foo: (struct){
   885            a: (int){ 1 }
   886          }
   887        }
   888        b: (struct){
   889          foo: (struct){
   890            a: (int){ 1 }
   891          }
   892          raises?: (struct){
   893          }
   894          ret: (struct){
   895            a: (int){ 1 }
   896          }
   897        }
   898      }
   899      cycleFail: (struct){
   900        t1: (struct){
   901          p1: (_|_){
   902            // [cycle] sameStruct.cycleFail.t1.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
   903            //     ./mutualsamestruct.cue:26:6
   904          }
   905          p2: (_|_){
   906            // [cycle] sameStruct.cycleFail.t1.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
   907            //     ./mutualsamestruct.cue:37:6
   908          }
   909        }
   910        t2: (struct){
   911          p1: (_|_){
   912            // [cycle] sameStruct.cycleFail.t2.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
   913            //     ./mutualsamestruct.cue:54:6
   914          }
   915          p2: (_|_){
   916            // [cycle] sameStruct.cycleFail.t2.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
   917            //     ./mutualsamestruct.cue:69:6
   918          }
   919        }
   920        t3: (struct){
   921          p1: (_|_){
   922            // [cycle] sameStruct.cycleFail.t3.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
   923            //     ./mutualsamestruct.cue:83:6
   924          }
   925          p2: (_|_){
   926            // [cycle] sameStruct.cycleFail.t3.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
   927            //     ./mutualsamestruct.cue:94:6
   928          }
   929        }
   930      }
   931      defCloseSuccess: (struct){
   932        #Example: (#struct){
   933          raises?: (#struct){
   934            runtime?: (string){ string }
   935          }
   936          ret?: (_){ _ }
   937        }
   938        expr: (#struct){
   939          raises?: (#struct){
   940            runtime?: (string){ string }
   941          }
   942          ret: (int){ 2 }
   943        }
   944      }
   945    }
   946    nestedChain: (struct){
   947      cycleFail: (_|_){
   948        // [cycle] nestedChain.cycleFail: cycle with field #E.y:
   949        //     ./nestedchain.cue:7:6
   950      }
   951      brokenCycleSuccess: (struct){
   952        #E: (#struct){
   953          y: (bool){ true }
   954          x: (bool){ true }
   955        }
   956      }
   957      doubleAddfail: (_|_){
   958        // [cycle] nestedChain.doubleAddfail: cycle with field #E.y:
   959        //     ./nestedchain.cue:28:6
   960      }
   961      trippleSuccess: (struct){
   962        #E: (#struct){
   963          y: (bool){ true }
   964          x: (bool){ true }
   965        }
   966        z: (bool){ true }
   967      }
   968    }
   969  }
   970  -- out/compile --
   971  --- in.cue
   972  {
   973    self: {
   974      fail: {
   975        a: {
   976          if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) {
   977            b: 1
   978          }
   979        }
   980      }
   981      isConcreteFail: {
   982        t1: {
   983          a: {
   984            if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) {
   985              b: 1
   986            }
   987            b: int
   988          }
   989        }
   990      }
   991      isConcreteFail: {
   992        t2: {
   993          a: {
   994            if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) {
   995              b: 1
   996            }
   997            b?: int
   998          }
   999        }
  1000      }
  1001      isNotConcrete: {
  1002        t1: {
  1003          a: {
  1004            if (〈1;a〉.b != _|_(explicit error (_|_ literal) in source)) {
  1005              b: 1
  1006            }
  1007            b: int
  1008          }
  1009        }
  1010      }
  1011      isNotConcrete: {
  1012        t2: {
  1013          a: {
  1014            if (〈1;a〉.b != _|_(explicit error (_|_ literal) in source)) {
  1015              b: 1
  1016            }
  1017            b?: int
  1018          }
  1019        }
  1020      }
  1021    }
  1022  }
  1023  --- mutual.cue
  1024  {
  1025    mutual: {
  1026      noConflicts: {
  1027        a: {
  1028          if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1029            new: ""
  1030          }
  1031        }
  1032        b: {
  1033          if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1034            new: ""
  1035          }
  1036        }
  1037      }
  1038      mutualCycleFail: {
  1039        b: {
  1040          if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1041            foo: ""
  1042          }
  1043        }
  1044        a: {
  1045          if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1046            bar: ""
  1047          }
  1048        }
  1049      }
  1050      brokenCycleSuccess: {
  1051        a: {
  1052          if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1053            foo: ""
  1054          }
  1055        }
  1056        b: {
  1057          if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1058            bar: ""
  1059          }
  1060        }
  1061        a: {
  1062          bar: ""
  1063        }
  1064      }
  1065      allowOneDirectionalDependency: {
  1066        p1: {
  1067          a: {
  1068            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1069              bar: ""
  1070            }
  1071          }
  1072          b: {
  1073            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1074              new: ""
  1075            }
  1076          }
  1077        }
  1078        p2: {
  1079          a: {
  1080            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1081              new: ""
  1082            }
  1083          }
  1084          b: {
  1085            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1086              foo: ""
  1087            }
  1088          }
  1089        }
  1090      }
  1091      oneDirectionalBrokenConflictSuccess: {
  1092        p1: {
  1093          b: {
  1094            foo: ""
  1095          }
  1096          a: {
  1097            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1098              bar: ""
  1099            }
  1100          }
  1101          b: {
  1102            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1103              new: ""
  1104            }
  1105          }
  1106        }
  1107      }
  1108      oneDirectionalBrokenConflictSuccess: {
  1109        p2: {
  1110          a: {
  1111            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1112              bar: ""
  1113            }
  1114          }
  1115          b: {
  1116            foo: ""
  1117          }
  1118          b: {
  1119            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1120              new: ""
  1121            }
  1122          }
  1123        }
  1124      }
  1125      oneDirectionalBrokenConflictSuccess: {
  1126        p3: {
  1127          a: {
  1128            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1129              bar: ""
  1130            }
  1131          }
  1132          b: {
  1133            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1134              new: ""
  1135            }
  1136          }
  1137          b: {
  1138            foo: ""
  1139          }
  1140        }
  1141      }
  1142      oneDirectionalBrokenConflictSuccess: {
  1143        p4: {
  1144          b: {
  1145            foo: ""
  1146          }
  1147          b: {
  1148            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1149              new: ""
  1150            }
  1151          }
  1152          a: {
  1153            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1154              bar: ""
  1155            }
  1156          }
  1157        }
  1158      }
  1159      oneDirectionalBrokenConflictSuccess: {
  1160        p5: {
  1161          b: {
  1162            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1163              new: ""
  1164            }
  1165          }
  1166          b: {
  1167            foo: ""
  1168          }
  1169          a: {
  1170            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1171              bar: ""
  1172            }
  1173          }
  1174        }
  1175      }
  1176      oneDirectionalBrokenConflictSuccess: {
  1177        p6: {
  1178          b: {
  1179            if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
  1180              new: ""
  1181            }
  1182          }
  1183          a: {
  1184            if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
  1185              bar: ""
  1186            }
  1187          }
  1188          b: {
  1189            foo: ""
  1190          }
  1191        }
  1192      }
  1193    }
  1194  }
  1195  --- mutualsamestruct.cue
  1196  {
  1197    sameStruct: {
  1198      chainSuccess: {
  1199        a: {
  1200          raises?: {}
  1201          if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1202            ret: {
  1203              a: 1
  1204            }
  1205          }
  1206          ret?: {}
  1207          if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1208            foo: {
  1209              a: 1
  1210            }
  1211          }
  1212        }
  1213      }
  1214      chainSuccess: {
  1215        b: {
  1216          if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1217            foo: {
  1218              a: 1
  1219            }
  1220          }
  1221          raises?: {}
  1222          if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1223            ret: {
  1224              a: 1
  1225            }
  1226          }
  1227          ret?: {}
  1228        }
  1229      }
  1230      cycleFail: {
  1231        t1: {
  1232          p1: {
  1233            raises?: {}
  1234            if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1235              ret: {
  1236                a: 1
  1237              }
  1238            }
  1239            ret?: {}
  1240            if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1241              raises: {
  1242                a: 1
  1243              }
  1244            }
  1245          }
  1246        }
  1247      }
  1248      cycleFail: {
  1249        t1: {
  1250          p2: {
  1251            ret?: {}
  1252            if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1253              raises: {
  1254                a: 1
  1255              }
  1256            }
  1257            raises?: {}
  1258            if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1259              ret: {
  1260                a: 1
  1261              }
  1262            }
  1263          }
  1264        }
  1265      }
  1266      cycleFail: {
  1267        t2: {
  1268          p1: {
  1269            raises: {}
  1270            if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1271              ret: {
  1272                a: 1
  1273              }
  1274            }
  1275            ret: {}
  1276            if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1277              raises: {
  1278                a: 1
  1279              }
  1280            }
  1281          }
  1282        }
  1283      }
  1284      cycleFail: {
  1285        t2: {
  1286          p2: {
  1287            ret: {}
  1288            if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1289              raises: {
  1290                a: 1
  1291              }
  1292            }
  1293            raises: {}
  1294            if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1295              ret: {
  1296                a: 1
  1297              }
  1298            }
  1299          }
  1300        }
  1301      }
  1302      cycleFail: {
  1303        t3: {
  1304          p1: {
  1305            raises: _
  1306            if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1307              ret: {
  1308                a: 1
  1309              }
  1310            }
  1311            ret: _
  1312            if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1313              raises: {
  1314                a: 1
  1315              }
  1316            }
  1317          }
  1318        }
  1319      }
  1320      cycleFail: {
  1321        t3: {
  1322          p2: {
  1323            ret: _
  1324            if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
  1325              raises: {
  1326                a: 1
  1327              }
  1328            }
  1329            raises: _
  1330            if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1331              ret: {
  1332                a: 1
  1333              }
  1334            }
  1335          }
  1336        }
  1337      }
  1338      defCloseSuccess: {
  1339        #Example: {
  1340          raises?: {
  1341            runtime?: string
  1342          }
  1343          if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
  1344            ret?: _
  1345          }
  1346        }
  1347        expr: (〈0;#Example〉 & {
  1348          ret: 2
  1349        })
  1350      }
  1351    }
  1352  }
  1353  --- nestedchain.cue
  1354  {
  1355    nestedChain: {
  1356      cycleFail: {
  1357        if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) {
  1358          #E: {
  1359            y: true
  1360          }
  1361        }
  1362        if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) {
  1363          #E: {
  1364            x: true
  1365          }
  1366        }
  1367        #E: {
  1368          [_]: bool
  1369        }
  1370      }
  1371      brokenCycleSuccess: {
  1372        if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) {
  1373          #E: {
  1374            y: true
  1375          }
  1376        }
  1377        if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) {
  1378          #E: {
  1379            x: true
  1380          }
  1381        }
  1382        #E: {
  1383          [_]: bool
  1384        }
  1385        #E: {
  1386          x: true
  1387        }
  1388      }
  1389      doubleAddfail: {
  1390        if (〈0;#E〉.x == _|_(explicit error (_|_ literal) in source)) {
  1391          #E: {
  1392            y: true
  1393          }
  1394        }
  1395        if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) {
  1396          #E: {
  1397            x: true
  1398          }
  1399        }
  1400        #E: {
  1401          [_]: bool
  1402        }
  1403      }
  1404      trippleSuccess: {
  1405        if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) {
  1406          #E: {
  1407            y: true
  1408          }
  1409        }
  1410        if (〈0;#E〉.y != _|_(explicit error (_|_ literal) in source)) {
  1411          z: true
  1412        }
  1413        #E: {
  1414          x: true
  1415        }
  1416      }
  1417    }
  1418  }