github.com/solo-io/cue@v0.4.7/cue/testdata/cycle/disjunction.txtar (about)

     1  -- in.cue --
     2  
     3  // cycle is a structural cycle
     4  cycle: a: cycle
     5  
     6  // reference to outside structural cycle
     7  r1a: cycle | int
     8  r1b: int | cycle
     9  
    10  r2a: cycle | 1
    11  r2b: 1 | cycle
    12  
    13  r3a: cycle | null
    14  r3b: null | cycle
    15  
    16  r4a: cycle | {}
    17  r4b: {} | cycle
    18  
    19  r5a: cycle | []
    20  r5b: [] | cycle
    21  
    22  // reference to ancestor node
    23  s1a: x: s1a | int
    24  s1b: x: int | s1b
    25  
    26  s2a: x: s2a | 1
    27  s2b: x: 1 | s2b
    28  
    29  s3a: x: s3a | null
    30  s3b: x: null | s3b
    31  
    32  s4a: x: s4a | {}
    33  s4b: x: {} | s4b
    34  
    35  s5a: x: s5a | []
    36  s5b: x: [] | s5b
    37  
    38  
    39  
    40  -- out/eval --
    41  Errors:
    42  cycle.a: structural cycle
    43  
    44  Result:
    45  (_|_){
    46    // [structural cycle]
    47    cycle: (_|_){
    48      // [structural cycle]
    49      a: (_|_){
    50        // [structural cycle] cycle.a: structural cycle
    51      }
    52    }
    53    r1a: (int){ int }
    54    r1b: (int){ int }
    55    r2a: (int){ 1 }
    56    r2b: (int){ 1 }
    57    r3a: (null){ null }
    58    r3b: (null){ null }
    59    r4a: (struct){
    60    }
    61    r4b: (struct){
    62    }
    63    r5a: (#list){
    64    }
    65    r5b: (#list){
    66    }
    67    s1a: (struct){
    68      x: (int){ int }
    69    }
    70    s1b: (struct){
    71      x: (int){ int }
    72    }
    73    s2a: (struct){
    74      x: (int){ 1 }
    75    }
    76    s2b: (struct){
    77      x: (int){ 1 }
    78    }
    79    s3a: (struct){
    80      x: (null){ null }
    81    }
    82    s3b: (struct){
    83      x: (null){ null }
    84    }
    85    s4a: (struct){
    86      x: (struct){
    87      }
    88    }
    89    s4b: (struct){
    90      x: (struct){
    91      }
    92    }
    93    s5a: (struct){
    94      x: (#list){
    95      }
    96    }
    97    s5b: (struct){
    98      x: (#list){
    99      }
   100    }
   101  }
   102  -- out/compile --
   103  --- in.cue
   104  {
   105    cycle: {
   106      a: 〈1;cycle〉
   107    }
   108    r1a: (〈0;cycle〉|int)
   109    r1b: (int|〈0;cycle〉)
   110    r2a: (〈0;cycle〉|1)
   111    r2b: (1|〈0;cycle〉)
   112    r3a: (〈0;cycle〉|null)
   113    r3b: (null|〈0;cycle〉)
   114    r4a: (〈0;cycle〉|{})
   115    r4b: ({}|〈0;cycle〉)
   116    r5a: (〈0;cycle〉|[])
   117    r5b: ([]|〈0;cycle〉)
   118    s1a: {
   119      x: (〈1;s1a〉|int)
   120    }
   121    s1b: {
   122      x: (int|〈1;s1b〉)
   123    }
   124    s2a: {
   125      x: (〈1;s2a〉|1)
   126    }
   127    s2b: {
   128      x: (1|〈1;s2b〉)
   129    }
   130    s3a: {
   131      x: (〈1;s3a〉|null)
   132    }
   133    s3b: {
   134      x: (null|〈1;s3b〉)
   135    }
   136    s4a: {
   137      x: (〈1;s4a〉|{})
   138    }
   139    s4b: {
   140      x: ({}|〈1;s4b〉)
   141    }
   142    s5a: {
   143      x: (〈1;s5a〉|[])
   144    }
   145    s5b: {
   146      x: ([]|〈1;s5b〉)
   147    }
   148  }