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

     1  -- in.cue --
     2  a: {
     3      {{
     4        b
     5        c
     6        d: b
     7        e: c
     8      }}
     9      c: {}
    10  }
    11  b: {
    12  
    13  }
    14  s: "foo"
    15  c: s
    16  
    17  // s is technically in a new struct here so it will have a one higher count than
    18  // the one before.
    19  d: [s]: 3
    20  
    21  e: { }
    22  e & { // Is this allowed? Probably not as per comprehension rule (ref fixes.)
    23      e: {}
    24  }
    25  
    26  {X=["foo"]: b: X | null}
    27  {[Y="bar"]: b: Y}
    28  
    29  let B = {open: int}
    30  f: B
    31  
    32  schema: {
    33  		next:  _schema_1
    34  }
    35  
    36  let _schema_1 = schema
    37  
    38  -- out/compile --
    39  --- in.cue
    40  {
    41    a: {
    42      {
    43        {
    44          〈3;b〉
    45          〈2;c〉
    46          d: 〈3;b〉
    47          e: 〈2;c〉
    48        }
    49      }
    50      c: {}
    51    }
    52    b: {}
    53    s: "foo"
    54    c: 〈0;s〉
    55    d: {
    56      [〈1;s〉]: 3
    57    }
    58    e: {}
    59    (〈0;e〉 & {
    60      e: {}
    61    })
    62    {
    63      ["foo"]: {
    64        b: (〈1;(〈1;-〉)〉|null)
    65      }
    66    }
    67    {
    68      ["bar"]: {
    69        b: 〈1;-〉
    70      }
    71    }
    72    f: 〈0;let B〉
    73    schema: {
    74      next: 〈1;let _schema_1〉
    75    }
    76  }
    77  -- out/eval --
    78  Errors:
    79  schema.next: structural cycle
    80  
    81  Result:
    82  (_|_){
    83    // [structural cycle]
    84    e: (struct){
    85    }
    86    a: (struct){
    87      d: (struct){
    88      }
    89      e: (struct){
    90      }
    91      c: (struct){
    92      }
    93    }
    94    b: (struct){
    95    }
    96    s: (string){ "foo" }
    97    c: (string){ "foo" }
    98    d: (struct){
    99    }
   100    f: (struct){
   101      open: (int){ int }
   102    }
   103    schema: (_|_){
   104      // [structural cycle]
   105      next: (_|_){
   106        // [structural cycle] schema.next: structural cycle
   107      }
   108    }
   109  }